My first Game - Android Platformer


#1

Hey I’m Jack, 16 years old and from Germany.
I’ve been playing the last few years a bit with HTML/CSS/JS, Photoshop, Cinema4D, ValveHammerEditor, Stencyl, … and a few days ago I’ve discovered GDevelop. :slight_smile:

For a long time I would like to make a game that other people, or at least my friends really like to play. I think a platformer for Android with 1 or 3 buttons should be a good choice. I completed the official tutorials on the website and it is really nice so far. But I’m not sure if it will succeed, because I think the cool things like shoot, teleport, elevator, double/wall jump, remaining lives, collect and use keys, use coins for updating skills, start and level menu, etc. are not so easy or really complicated and (of course) there are no detailed tutorials for all that. I have no idea how I can build the things I definitely need to the game makes sense and fun, and the language doesn’t make it any easier.

Currently I have 2 problems.
I use 64x64 graphics and they are getting worse in the game. Is this normal because of different resolutions of devices or so? Is 64 okay for my project?
https://i.imgur.com/qUrohbN.png

If I add a player sprite, GDevelop automatically adds a hitbox. It is 1px larger than the graphic in all directions. Unfortunately not in all directions, top 0px, bottom 2px.
That’s why my player is not standing on the ground but has 1px gap. I can fix it with Custom Hitbox but is it a bug?
i.imgur.com/HcLgJx5.png


#2

Hi Jack and welcome to the forum. :slight_smile:

Problem 1 can be solved by disabling “smooth the image” in the the resources screen.

Problem 2 is a known bug which hasn’t been busted yet:
https://github.com/4ian/GDevelop/issues/519


#3

Dankeschööön :slight_smile:

What is the white and black frame in the editor?
The black one is “Mask” and has the size 1200x600 which I have selected. But both are definitely not the area that I see in Preview, HTML and apk. The control buttons are on the GUI layer, the camara event is not the problem. But… in the Platformers demo I have two black frames and there the positions are correct. :astonished:
i.imgur.com/X0XDS0A.jpg


#4

Check the project settings, at the end there are options to change the window and camera size to fit the screen. What GD is doing right now in your game is changing the camera size so the graphics don’t get stretched when it fills the screen horizontally :slight_smile:


#5

Okay after restarting GD the frame has the settet size, and he was white because the background color was dark.
The solution for the correct position on the right side is an anchor behavior for the control button on the right side, as shown in the demo.


#6

Yep, since it automatically resizes the screen size (which is different from the initial screen size on the editor when you designed the UI), an anchor is needed.


#7

How can I manipulate, delete, etc. a sprite object with “Platform” behavior?
I want a bridge that collapses when I stand too long on it.
(player is in collision with bridge - Delete object bridge) works only without behavior, but then I can’t stand on it.
I found the action “De/activate a behavior” but it does not work
How can I use a delay between the trigger and the action?

Thanks for your help :slight_smile:

edit: okay i added an invisible player hitbox with Y + 1, now it works.
But how does delay/setTimeout() work?
I think I need this very often when I don’t want it all to happen right away.


#8

I want to build a simple coin animation without different sprites, with manipulating size and position.
Size - Scale unfortunately does not work with pixel unit, so I tried using an object variable.

Of course it can not work that way. I also tried a scene timer, but I don’t know…


#9

I guess it actually works, but your code will keep the value around 95 always.
If the value is slightly > 95 subtract -TimeDelta() and increase scale, the next frame the value will be slightly < than 95, add TimeDelta() and reduce scale. So it does the smaller-bigger animation but very fast and subtle.

You need a direction tracker variable:
Scale.png


#10

Hi Guys
I wanted to continue working on my game and now I have a problem with version beta58 and newer.
“Add a force (angle)” no longer works with physics behavior.
I have an object that moves and falls off a platform when I jump on the platform and a second object that I can push down with the player. Both does absolutely nothing since the update.
I also tried the two new options force “Instant” or “Permanent” and Physics2.


#11

You should not use the GD built-in forces with the physics behavior, use the physics forces instead or set the linear velocity directly (again, using the physics actions) :slight_smile:

Aside that, using GD forces should work, but the response won’t be physically accurate as you are teleporting the object, maybe 4ian added a patch to avoid mixing forces, I’ll take a look if I find some time.


#12

Here is what I want to do.
memu.ga/57
memu.ga/61
Maybe you can “repair” it in the next few weeks, I don’t know how it exactly works with others things.
memu.ga/Game.zip


#13

Maybe you’ve forgotten to update to the new physics behavior on the cars?, sorry, I can’t check the project right now but will try to do it tonight :slight_smile:


#14

No problem, there’s no hurry. :slight_smile:

I have still another question.
When I add a new layer and then add objects to it, they move with the player and don’t stand in the world like the things on base layer. Is it possible to have fixed objects on more than one layer?


#15

If you mean two layers moving together, all you have to do is move the camera of the second layer to the same position than the first one, if both cameras are looking at the same place it would be like there is one layer only (just modifying the drawing order).
Actually, not only the camera position, but also the angle and zoom must be the same, but not many people change them :slight_smile:


#16

Oh great thanks
If I add a “Center the camera on …” action for both layers, it works exactly as I would like. :slight_smile:


#17

Can I block the user control at an event?
I want to add movement force to the player and he should not be able to walk in the other direction, before the “stop object” action is not activated.
I’m building a portal that works in both directions. If I fall out of one and still press the walk button, I go back in the portal again and again…


#18

You’ll have to flag it manually, in the event that start moving the player set a variable “bussy” = 1, and in the event that stop the player set “busy” back to 0.
Then, all your events that manage the user input should be sub-events of a master event that checks if the player is not busy:

[code]Conditions: Variable “busy” is = 0
Actions: No actions

// sub-event
Conditions: Left key is pressed
Actions: Move to the left

// sub-event
Conditions: Right key is pressed
Actions: Move to the right

...[/code]

This variable will be useful for any event that set the player in a non-controllable state, for example when the player is knocked/pushed back, if is talking to an npc, if is controlling a machine or playing a minigane inside the game, etc. :slight_smile:

Btw today I was finally trying your project that has that physics bug, moved the player two centimeters but my laptop just went out of battery, will do it tonight :blush:


#19

Ok, I was able to try out your project… finally. It is not a bug, it’s a feature! :laughing:
It’s very technical, but the code to update the object forces has been moved before running the behaviors code… in the end, the physics behavior now ignores the built-in forces, you’ll have to use the physics forces or linear velocity :slight_smile:


#20

Linear velocity is what I needed, thank you! :slight_smile:

I already had this variable for flip the player animation in the right direction during busy.
But I can’t build your variable because there is no “Move to the left” action. The player control is automatic with the “PlatformerObject” Behavior?!

I have another thing that I’ve tried for maaany hours and maybe you can help very easily.
The first part of my level has this camera.
Center the camera on player (limit : from -180;900 to 4900;700)(layer: , camera: )
If I walk into the second part, I’ll start that. (I don’t know why but it was the best result of all experiments)
Do = player.Y(top) - 130 to Y position of camera (layer: )
So the player is not in the middle but lower.
Now I think it’s better if I don’t do it right now but slowly. I tried something with TimeDelta etc. but I do not know… Cameras and all the coordinates confuse me completely. I’ve just started hundreds of previews to see what a change does.