Problem in the gravity for enemies
Hi everyone,
I'm having a problem. In my game, I put the same object in several positions in my frame (enemies). The condition says than if the object is not overlapping a backdrop, it'll fall (gravity).
Well, I'm making:
Code:
X"Object" is overlapping a backdrop:
- Start a loop Gravidade Object's Alterable Value G times
- Add 1 to Object's Alterable Value G
X"Object" is overlapping a backdrop
+ On loop "Gravidade":
- Set Y position "Object" as Y Object" + 1
This works fine when there one Object in frame, but when I put more object, the behavior of the fall is not the expected.
Anybody can help me? :/
Re: Problem in the gravity for enemies
Your On Loop condition needs to be the first condition in the event. Also you put no code in to specify which object you are running the code for, which can cause problems with multiple objects like you are experiencing.
Re: Problem in the gravity for enemies
Thanks for the reply, LB, but did not understand this part:
" Also you put no code in to specify which objectyou are running the code for, which can cause problems with multiple objects ".
sorry for the inconvenience, but would you explain again?
EDIT: Wooow, works fine noe. Thanks, LB! :D
Re: Problem in the gravity for enemies
Well, works if there two objects. To three or more, no :(
Re: Problem in the gravity for enemies
Here is a quick example. There are probably better ways... and I'm not sure if this one will suit your game.
http://mfa.aquadasoft.com/upload/1312340389-Gravity_Ls2.mfa
Re: Problem in the gravity for enemies
mojofltr,
This solution is quite interesting: D Thank you!