How do I destroy objects by hitting them?

Just started using Construct 2? Post your questions here

Post » Sun Jan 15, 2017 1:35 am

Hi everyone, me again. I watched some tutorials on how to destroy boxes like with SuperMario. However, I don't want to jump and simply collide with them, but I want to hit them while standing on them. My player is animated, so it looks as if he hits something below when you press arrow down.
I already created one of these dummys. The box serves as container for the invisible Hitbox (same size as normal box). My idea was the following:
System on start of layout: Hitbox set position to Box
Conditions: Player on collision with Hitbox AND another condition: Keyboard: Down arrow is down. Action: Box destroy
capx:
https://www.dropbox.com/s/z12e57mprk7k0hu/2..capx?dl=0
It is just not working...
Thank you so much for answers!
B
12
S
3
G
1
Posts: 46
Reputation: 1,518

Post » Sun Jan 15, 2017 4:05 am

It's because your player dummy box isn't actually colliding with the box. It's sitting on top of it. If you swap out player dummy box for player (the animation), it will work the way you have it set up.

You could also set it up a couple different ways. One way is that you could probably play around with the collision polygons on your sprites to make it work. Another way, and what I would probably do, is to make an invisible detector sprite that follows the player box just under it and destroy the box if that detector sprite is overlapping the box and the down arrow is pressed.
B
62
S
20
G
56
Posts: 1,077
Reputation: 36,021

Post » Sun Jan 15, 2017 11:09 am

Jipii! To be honest, I don't really understand the difference between sitting on top and colliding with, but it works! No I try to add some animation to the box before it disappears.
Vielen Dank ;-) also for the other options, which I'll keep in mind!
B
12
S
3
G
1
Posts: 46
Reputation: 1,518

Post » Sun Jan 15, 2017 7:55 pm

ok, update: The advice with the detector was the best solution. It's more precise now!
B
12
S
3
G
1
Posts: 46
Reputation: 1,518

Post » Sun Jan 15, 2017 10:43 pm

I'm glad to hear it's working for you. And I like your animation, by the way.
B
62
S
20
G
56
Posts: 1,077
Reputation: 36,021


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 2 guests