Making the enemy destroy when the Player is on top

Get help using Construct 2

Post » Tue Dec 17, 2013 3:30 am

I looked on the FAQ "Mario style: jump on top of enemy to kill it" which is exactly what I am trying to do. When I try to do it if they collide the enemy destroys, no matter if its on top or side to side. I want to keep the side to side where if it hits the player he will take damage. But if he jumps on him it will destroy the enemy. Please help.
B
3
Posts: 13
Reputation: 201

Post » Tue Dec 17, 2013 4:10 am

Make another object the same size as your character. Match up the new object and your character in the editor. Pin that object to your character. Make the object invisible. Change the objects collision polygons so that it matches up with your characters feet. Make sure that you leave a pixel or two on each side, you might need to play around a little to get it exactly how you want it. Set up that object in your events so it does damage to enemies, rather then your character. Also, you may need to update the collision polygons on your character so you aren't also taking damage when you jump on the enemy.

There are probably better ways to do it but that will work and get you started in the right direction.
B
62
S
20
G
56
Posts: 1,077
Reputation: 36,021

Post » Wed Dec 18, 2013 1:55 am

Ok I am trying to do that but I am having trouble keeping the collision detection box pinned. I have't even tried to set it up where it is at his feet. It stays there for a little while and then starts to move as I keep going right. I am so confused and frustrated.

Update: I tried On Collision Pin and Every Tick Pin oh also on created

Every Tick doesnt even work it wont pin a tall. On Collison is the way I was doing it where it would stay there then start moving after you move so far its so weird.akoji2013-12-18 02:04:45
B
3
Posts: 13
Reputation: 201

Post » Wed Dec 18, 2013 2:29 am

Use at start of layout to pin it. If it's lined up in the editor you should be good.
B
62
S
20
G
56
Posts: 1,077
Reputation: 36,021

Post » Wed Dec 18, 2013 2:41 am

That works thank you. I figured out why it was moving had it on the wrong layer had it on my HUD layer which has 0 paralax haha.
B
3
Posts: 13
Reputation: 201

Post » Wed Dec 18, 2013 2:42 am

Ah, yes, that will do it. :)
B
62
S
20
G
56
Posts: 1,077
Reputation: 36,021

Post » Wed Dec 18, 2013 2:50 am

Assuming you're using the platform behaviour just create a normal destroy on collision event and add the conditional "isFalling".
B
64
S
25
G
10
Posts: 654
Reputation: 10,842

Post » Wed Dec 18, 2013 7:38 am

Akoji, were you able to get so that the enemy dies only when you land on top and not land on the side? I'm having difficulty making it so that only when you land ON TOP of the enemy does the enemy die. If you fall on the side of the enemy it should hurt you, at least when trying to replicate a Mario game. I don't follow how the invisible object for damage resolved the issue when landing on the side of an enemy..

[QUOTE=Mr E Bear] Assuming you're using the platform behaviour just create a normal destroy on collision event and add the conditional "isFalling".[/QUOTE]

That allows you to fall on the side of the enemy to kill it (in other words, this method will not require you to hit the TOP of the enemy), which does not match with Mario games since in those games you die if you hit the side of Goomba instead of the top.
B
13
S
3
G
3
Posts: 35
Reputation: 2,731

Post » Wed Dec 18, 2013 7:57 am

Mmm, what about making an invisible collider pinned on top of each enemy? Just a small sprite about half as wide as enemy. That should fix the "falling on side" issue.
Actually, here's a capxJJList2013-12-18 08:30:27
B
18
S
5
G
1
Posts: 74
Reputation: 2,672

Post » Wed Dec 18, 2013 9:51 pm

I did it by pinning a collision box on start of layout to the feet of the player. Then have that set where if it collides with the enemy it will destroy it. Once I am done with what I am doing I will post the capx for everyone would love some feedback on my first game.
B
3
Posts: 13
Reputation: 201

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 8 guests