My first Game - Android Platformer

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.

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.

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…

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:

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.

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.

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

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.