punch/being punched

Get help using Construct 2

Post » Sat Sep 21, 2013 3:59 pm

Hi, I'm new to Construct 2 program.

I followed the platform tutorial and I learned a lot, but I want to make a platformer/side-scroller beat them up game with multiple levels.

First thing I noticed that I need to know was, if I want to program a punch, is there a way to make only the punching hand (and not the whole character sprite) deal damage to the enemy? can I make like a 3 hit combo (meaning like 3 different types of punches) by tapping the same button once?

Also, in the tutorial, it said that I should use an object similar to how "playerBox" for an enemy similar to how it was used for player in the tutorial? I want my enemy to be hittable several times before dying.

The player and the enemy are both persons, so hopefully you get the idea. You beat up all the enemies by punching them repeatedly.

thanks in advance. thank you for the awesome Construct 2 program even more.
B
16
S
7
Posts: 301
Reputation: 2,726

Post » Sat Sep 21, 2013 4:29 pm

Hold on, I am searching for the correct tutorial.
HARMLESS SIGNATURE THAT IS VIEWED BY OTHERS AS OFFENSIVE AND CONTROVERSIAL
B
14
S
3
G
3
Posts: 356
Reputation: 4,377

Post » Sat Sep 21, 2013 4:30 pm

https://www.scirra.com/tutorials/468/part3-basic-fighting-game-tutorial-video-series
HARMLESS SIGNATURE THAT IS VIEWED BY OTHERS AS OFFENSIVE AND CONTROVERSIAL
B
14
S
3
G
3
Posts: 356
Reputation: 4,377

Post » Sat Sep 21, 2013 5:57 pm

hmmm. thanks. Seems like a more advanced tutorial than the beginner one. Actually, it definitely is more advanced.

Can I start editing his .capx file? Is it allowed?

I want to make a platform side scroller beat em up game, not a 1 vs 1 fighting game.

I think he did not cover how to make the enemy get hurt from the player's attacks. I would also like to learn how to make enemy go up in air (like if I use an uppercut) before falling down to ground.

Thanks again.
B
16
S
7
Posts: 301
Reputation: 2,726

Post » Sat Sep 21, 2013 6:15 pm

Basically, fighting games are beat 'em ups, technically, but with levels and enemies and stuff.

How to make stuff get hurt is explained in the novice tutorial you must have read of. Or do you mean you want them to play an animation when they get hurt?

Swinging stuff up is used through y vectors, in the set x/y vector action, which belongs to the platform behavior.

And, you know? For starters, you should make your character not punch, but create a projectile that shoots, or an explosion, like in my Action Gamemaster game when you press Z. That is, for starters. Trying to do punches and stuff is complex, and you should learn more about C2 engine before that. For now, try to develop the rest of the game while punches and kicks and stuff are substituted with something simpler. Or, you might try to create a different kind of game just for training.
HARMLESS SIGNATURE THAT IS VIEWED BY OTHERS AS OFFENSIVE AND CONTROVERSIAL
B
14
S
3
G
3
Posts: 356
Reputation: 4,377

Post » Sat Sep 21, 2013 6:15 pm

editing his capx is fine, but only for training.
HARMLESS SIGNATURE THAT IS VIEWED BY OTHERS AS OFFENSIVE AND CONTROVERSIAL
B
14
S
3
G
3
Posts: 356
Reputation: 4,377

Post » Sat Sep 21, 2013 6:56 pm

What games like this do is create Hit Box sprites.
Here is a good example, the Red Box is the hit box.



Those sprites are created during the animation of the move, but are invisible sprites so you don't see them. However, they are what the game uses for collision detection. The blue boxes are where the character can be hit during that particular frame of animation.

So in your case, say you have a 6 frame animation for your punch. In Construct you would say When Animation is at Frame 2, create hitbox sprite at the right locations (usually using an image point). When the animation is at frame 6, destroy the hitbox sprite.

Then you just check for collision with that hitbox sprite. Make sense?
B
101
S
32
G
11
Posts: 1,552
Reputation: 21,667

Post » Sun Sep 22, 2013 6:52 am

Thanks for the replies.

I am preparing first the platform (BG and floor) before I start programming any attacks.

I can try coding a projectile for the learning aspect, but my char just punches and kicks.

I want to learn how to do 3 kinds of hurt:
- items (you hit a box and the box shows a breaking animation before disappearing)
- goons enemies (you hit them, they show hurt animation, then they go back to idle and can attack if they are still alive, OR disappear if they are dead)
- bosses (basically like a player complete with animations for idle, walk, jump, attacks, probably add even stand hurt, air hurt, lie down, get up, etc.) this one's the enemy you can uppercut and he will go up in the air before falling (lie down, get up)

so since I know how hitboxes work, I have a few questions regarding how it is implmented in C2:
- should both attacker and the item/enemy being hit be programmed to detect the collision?
- in the point of view of the player (attacker), in the tutorial, there was a playerBox that does most of the functions of the player, so will the playerBox be the one detecting both the attacking and being attacked aspects of the player?
- should I use "object in contact with another object" event for hitbox collision? not sure how exactly to implement it but that's the first event that came to my mind for this
Last edited by sgn15 on Tue Mar 03, 2015 5:38 am, edited 1 time in total.
B
16
S
7
Posts: 301
Reputation: 2,726

Post » Sun Sep 22, 2013 7:31 am

- in the point of view of the player (attacker), in the tutorial, there was a playerBox that does most of the functions of the player, so will the playerBox be the one detecting both the attacking and being attacked aspects of the player?
YES
- should I use "object in contact with another object" event for hitbox collision? not sure how exactly to implement it but that's the first event that came to my mind for this
YES there is a condition called on collision with
HARMLESS SIGNATURE THAT IS VIEWED BY OTHERS AS OFFENSIVE AND CONTROVERSIAL
B
14
S
3
G
3
Posts: 356
Reputation: 4,377

Post » Sun Sep 22, 2013 12:24 pm

ok thanks. I will try coding a punch later. I just made 2 layouts now. There is a minor issue in the 2nd layout.

My layers are in this order:
Main screen
Background and floor (1 single sprite) with transparent at the top (png file)
Sky background

the background layer over the sky is not showing the sky. C2 doesn't recognize the transparency of the png?

Right now, I just pasted the BG sprite over the sky sprite in the same level (Background) and deleted the sky layer to make it work.
B
16
S
7
Posts: 301
Reputation: 2,726

Next

Return to How do I....?

Who is online

Users browsing this forum: evillair, mongoose665, StillSarah and 62 guests