My first Game - Android Platformer

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:

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?

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:

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

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…

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:

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:

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.

I have a waterfall of 14 single images, 8 same segments above each other. It works good, but if I run away and come back, it is messed up. The only solution I have is making my fourteen 110x64 to 110x512 graphics in photoshop.
For my river I have to copy more than 30 same 64px sprites in a row.
Maybe it would be a good idea if “Tiled Sprite” also allow sprite animations in the future.

It is hard to tell how your waterfall looks in motion. But you could also achieve something similar by animating the y-offset of a tiled sprite like so:
waterfall.gif
The waterfall consists of two tiled images, one light and one dark blue which are placed on top of each other.

@Wendigo Okay danke, probiere ich mal wenn ich wieder ein Problem damit hab. Jetzt habe ich erstmal den ganzen Wasserfall als eine Grafik gemacht, ist insgesamt nur 40kb größer. Hat dadurch dann zwar zwangsläufig ein z order Problemchen wenn man beim Wasserfall in den Fluss springt, aber das ist verschmerzbar.
Ein Video von der Preview recorden war sehr rücklig und pixlig, aber wenn du es dir kurz ansehn möchtest, hier meine Projektdateien. memu.ga/game2.zip

In Kommentar #69964 hat mir Lizard-13 eine Variable erklärt mit der man die Player Steuerung zeitweiße deaktivieren kann. Klingt soweit auch genau nach dem was ich brauch, und ist sicher oft praktisch wenn bestimmte Eingaben nur in bestimmten Situationen gehen. Allerdings weiß ich nicht wie ich “Actions: Move to the left” verwenden soll, da der Player ja seine Steuerung automatisch durch das Platformer Behavior und nicht durch einzelne Actions bekommt.

Please don’t get offended but it’s an english forum, try to not write too much in other languages… btw the GD Discord server has a German channel :slight_smile:

First you have to deactivate the default controls in the platformer behavior settings, with this the arrows and shift/spacebar won’t work to move the character by default.
Then you’ve to use the actions to simulate a key pressed, in the platformer section there’re actions to stimulate left, right, jump, etc. It should look like:

Conditions: Left key is pressed Actions: Simulate pressing Left for Player
The same for other controls, and as you’re now controlling the movement with events you can put them all as sub-events of a parent event checking that the player can move :slight_smile:

Ahh okay now it works. :slight_smile:

How can I change

Conditions: Variable inTown of player = 1 Actions: Do = player.Y(top) +32 to Y position of camera (layer: "Town")to

Actions: Do = player.Y(top) -130 to Y position of camera (layer: "Town") slowly?
It’s supposed to be a sunset.
I have tried a lot, so unfortunately I have to ask again.

@Jack: I can’t download “memu.ga/game2.zip”. Could it be that you forgot to click on “Add the file” after choosing it as an attachment?

It was on my own webspace but not declared as a link.
Now it’s as an attachment.

I had a look at you game. The waterfall animation looks exactly the same as yours when you use “wa1.png” on a tiled sprite and shift the y-offset of the texture. But to my surprise I noticed that changing the opacity of tiled sprites is not possible. :frowning:
Nice graphics by the way, I really like your mountain/forest background. Very atmospheric. :slight_smile:

Perfect thanks, so I save 13 images for the waterfall and 13 for the river :slight_smile:

The Y axis works in reverse in GDevelop, so a position of -130 is actually above +32.

Anyway, to make the sun set just use a scene variable e.g. "sunset"in place of the 32 (give it a value of -130 at the start of the scene) and add another action that adds a certain amount to it every second. Something like the following will move the sun down by 1 pixel every second.

Actions: Do = player.Y(top) +Variable(sunset) to Y position of camera (layer: "Town") Do -1*TimeDelta() to variable sunset

If that’s too fast, change the 1 to 0.5 or 0.1 or whatever works.
To stop it at +32 just add a check for that as a condition (better to check if <33 than if =32) at the same time you are checking that the Variable inTown of player = 1.

Works well, thank you :slight_smile:

I added 3 times the same object with an animation, but they are not in sync. That’s the same problem I had at the waterfall.
Is it because I have too many sprites with animations in my scene? There are 35 with all collectibles.
coin.gif