When the enemy dies it wants to stop moving


#1

i don’t know what’s wrong with my code please help me,


that is my code


#2

Could you explain in more detail what’s the problem?


#3

when my player and my enemy collision my player is jump again(which is good) but my enemy is still move (i want the enemy to stop moving) n if my player fall in enemy my player will jump again (if enemy still not delete)
(sorry for bad english)


#4

Still not sure if I understand… If you want the enemy to stop moving when there is a collision with the player, you could try some of these Actions with your enemy object.

Stop the object
Remove all forces
Set the X/Y position of the Enemy to it’s own current X/Y position (but don’t use Trigger Once as a condition)


#5

thanks, i will try it


#6

still not working


this is my new code


#7


this is what happen.
even when my slime did the animation of dead(mati)
it is still moving if i use (stop force) it only stop when it collision with player after that it began to move again


#8

if i use (delete object) it will delete the slime immediately, without play the slime dead(mati) animation, and i want when then slime did play dead(mati) animation it is stay still.
not going around like that picture,
please can you help me,


#9

Two things you could try…

In the player with enemy collision…
In Action field try “Position of an Object” (for the musuh object)… Then edit the code to this >>>

Change the position of musuh set to musuh.X() , set to musuh.Y()

You could also try this as an Action:

Change the acceleration of musuh set to 0.


#10

Also in the player with enemy collision try doing this

Change the variable arah of musuh = 2

Because it looks like you aren’t stopping the movement… if you put variable arah = 2 I think that might stop the other two movement actions that you have on the arah variable .


#11

thanks bro
but nothing work,
maybe there’s wrong with my upper coding,
i dont know.
i am just try to star over it
is there a place where i can download some kind of project like super mario game,?
i want to see the coding behind it.
thank so much for helping btw


#12

Did you try doing as part of the player with enemy collision condition…

Change the variable arah = 2

Then in a new event try…
Condition: Variable of arah = 2
Action: Stop all forces
Action: Change the position of musuh set to musuh.X() , set to musuh.Y()
Action: Change acceleration set to 0


#13

Here’s a platformer example (same one that comes included with GDevelop I think) https://editor.gdevelop-app.com/?project=example://platformer


#14

thanks you very very much,
i am gonna star over again with the coding


#15

yeap,
that is the same one that included in gdevelop (i cant understand how they did it, cause its just some kind of mess to me to see it) i dont know,
maybe i am just very very dumb (but still gonna learn it though) :slight_smile:
thanks


#16

Nah it takes time to learn it… There is tons of stuff I still have to learn too

One thing that I noticed I think is that you activate the behavior of the musuh during the collision but you don’t deactivate it straight afterwards, during the fade out (as they do in the example)