Making the enemy destroy when the Player is on top

Get help using Construct 2

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

Post » Thu Dec 19, 2013 3:34 am

[QUOTE=JJList] 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 capx[/QUOTE]

Ah of course, why didn't I think of that. Thank you for the advice and also thank you for including an example capx.


[QUOTE=akoji] 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.[/QUOTE]

I'm curious if that method will still allow you to kill the enemy if you fall on the side of the enemy because the feet of the player can still touch the side of the enemy as you are falling if the enemy is big enough.
B
13
S
3
G
3
Posts: 35
Reputation: 2,731

Post » Thu Dec 19, 2013 3:42 am

[QUOTE=Enzan]Ah of course, why didn't I think of that. Thank you for the advice and also thank you for including an example capx.
[/QUOTE]

Anytime, mate :)


[QUOTE=Enzan] [QUOTE=akoji] 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.[/QUOTE]

I'm curious if that method will still allow you to kill the enemy if you fall on the side of the enemy because the feet of the player can still touch the side of the enemy as you are falling if the enemy is big enough.[/QUOTE]

I guess it will ;(
Well, depends on how collider sprite is set up, but still might be buggy. Either way that works is fine, i think :P
B
18
S
5
G
1
Posts: 74
Reputation: 2,672

Post » Thu Dec 19, 2013 5:19 am

[QUOTE=JJList] [QUOTE=Enzan]Ah of course, why didn't I think of that. Thank you for the advice and also thank you for including an example capx.
[/QUOTE]

Anytime, mate :)

[/QUOTE]

I was trying to apply your example to this demo and I am getting some weird bugs.. I'm probably not doing it right .. I'm also trying to put the bad guys into a Family (will create more characters later) and I think that is what is causing the issues.

Issues:
1. When an enemy is created, the collider does not follow the enemy properly
2. Sometimes you can land on the head of the enemy and no damage is done... you just ride the enemy
3. All enemies die when an enemy is killed (not sure how to specify only to kill the enemy that was stomped on)

Here is the capx I am working on:
https://www.dropbox.com/s/f38avjx9f0nbuuf/A2.capx

Any suggestions or advice is appreciated.

Meanwhile I will read up more on Families and such. I still have a lot to learn.Enzan2013-12-19 05:20:46
B
13
S
3
G
3
Posts: 35
Reputation: 2,731

Post » Thu Dec 19, 2013 6:47 pm

@Enzan Oh, I see. Well, I didn't manage to make Containers work with families properly :(
So here is an other way.
No containers involved, but you need to add a variable to Collider object.
looks like it's working fine, hope that helps:)

P.S:
[QUOTE=Enzan]
2. Sometimes you can land on the head of the enemy and no damage is done... you just ride the enemy
[/QUOTE] Hmm, try to play around with Collider width and position, might fix the issue.JJList2013-12-19 18:51:55
B
18
S
5
G
1
Posts: 74
Reputation: 2,672

Post » Tue Dec 24, 2013 6:01 am

Thanks for the help JJList. The way you handled pinning the collider works great.

Sadly I have not been able to get the second issue resolved (sometimes being able to land on the head of the enemy). I have tried even making the collider ridiculously large and sometimes the Player still falls through the collider and lands on the head of the enemy. You can re-create this issue on the previous capx by going to the top platform and falling onto the enemies head (don't jump).

I'll keep trying to figure it out but so far it has got me very stumped.

edit: I'm thinking of just going off of your capx and building from there.. this issue has got me beat and I don't understand how it is an issue on my capx but not on yours . I'm mostly just trying to learn right now so this really bugs me.Enzan2013-12-24 06:29:13
B
13
S
3
G
3
Posts: 35
Reputation: 2,731

Previous

Return to How do I....?

Who is online

Users browsing this forum: Kin, Yahoo [Bot] and 42 guests