Page 2 of 3

Re: My first Game - Android Platformer

PostPosted: Tue 8 Jan 2019, 14:23
by Lizard-13
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) :)

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.

Re: My first Game - Android Platformer

PostPosted: Tue 8 Jan 2019, 18:07
by jack
Here is what I want to do.
http://memu.ga/57
http://memu.ga/61
Maybe you can "repair" it in the next few weeks, I don't know how it exactly works with others things.
http://memu.ga/Game.zip

Re: My first Game - Android Platformer

PostPosted: Wed 9 Jan 2019, 13:27
by Lizard-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 :)

Re: My first Game - Android Platformer

PostPosted: Thu 10 Jan 2019, 10:37
by jack
jack wrote: I also tried Physics2.

No problem, there's no hurry. :)

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?

Re: My first Game - Android Platformer

PostPosted: Thu 10 Jan 2019, 12:22
by Lizard-13
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 :)

Re: My first Game - Android Platformer

PostPosted: Thu 10 Jan 2019, 13:06
by jack
Oh great thanks
If I add a "Center the camera on .." action for both layers, it works exactly as I would like. :)

Re: My first Game - Android Platformer

PostPosted: Fri 11 Jan 2019, 14:45
by jack
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..

Re: My first Game - Android Platformer

PostPosted: Fri 11 Jan 2019, 15:39
by Lizard-13
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: Select allConditions: 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

    ...


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. :)

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 :oops:

Re: My first Game - Android Platformer

PostPosted: Sat 12 Jan 2019, 14:07
by Lizard-13
Ok, I was able to try out your project... finally. It is not a bug, it's a feature! :lol:
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 :)

Re: My first Game - Android Platformer

PostPosted: Sat 12 Jan 2019, 22:21
by jack
Lizard-13 wrote:the physics behavior now ignores the built-in forces, you'll have to use the physics forces or linear velocity :)
Linear velocity is what I needed, thank you! :)

Lizard-13 wrote: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. This variable will be useful for any event that set the player in a non-controllable state
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.