Hit Box for Brawler.

Get help using Construct 2

Post » Tue Mar 19, 2013 8:53 pm

Hi

Im implementing a brawler, with a collision logic as this one:

http://www.raywenderlich.com/24452/how-to-make-a-side-scrolling-beat-em-up-game-like-scott-pilgrim-with-cocos2d-part-2

and I want to do this:

whenever the player (using the platformer behavior) presses a button, I want to spawn a HitBox (that will represent the fist). Its location should be x pixels in front of the character (so it the HitBox hits the enemy, it dies).

The hit box should exist for half a second, and then disappear.

The thing is that when my player is moving, his HitBox should move with him.

How can I do that?

So far, I spawn a hitbox by the playerBox, but this leaves it floating on space on the place it was created.

I considered a main game OnEveryTick, but the HitBox should be local to the player, as the enemies will use their own HitBox.

Thanks.
B
7
S
3
G
3
Posts: 53
Reputation: 2,459

Post » Wed Mar 20, 2013 12:05 am

you need to spawn your hitbox in your player, then wait like 0.2 seconds then destroy it

check this

https://www.dropbox.com/s/xbztl89iqlhe5ph/Untitled.pnghaifisch2013-03-20 00:06:23
B
17
S
2
G
2
Posts: 82
Reputation: 1,712

Post » Wed Mar 20, 2013 12:28 am

thanks.

That was my first thought, but the problem is that the hitbox stays floating in mid air when the player moves (for the 0.2 seconds).
B
7
S
3
G
3
Posts: 53
Reputation: 2,459

Post » Wed Mar 20, 2013 12:41 am

can you upload your capx?
B
17
S
2
G
2
Posts: 82
Reputation: 1,712

Post » Mon Mar 25, 2013 10:28 pm

Thanks.

Solved it with the Pin behavior.
B
7
S
3
G
3
Posts: 53
Reputation: 2,459

Post » Tue Mar 26, 2013 12:15 am

but if you pin the hit box to your player and you hit and move the hitbox will move with you right? so if the animation stops and you move you will hit your enemies even if the animation stoped right?

because i dont use the pin behavior with my hitboxes so if you could explain how it works i would appreciate it.
B
17
S
2
G
2
Posts: 82
Reputation: 1,712

Post » Fri Aug 28, 2015 5:13 am

@haifisch
I've been debating about this myself.
My solution is to load separate animations on a successful hit.
As the animation plays the character that was hit the pin's location doesn't matter.
On the default animation, I would have the hit box pin reset.
B
14
S
5
G
2
Posts: 164
Reputation: 2,926


Return to How do I....?

Who is online

Users browsing this forum: Callan S, getplay, tomi71 and 26 guests