How do I make beat em up jump?

Get help using Construct 2

Post » Mon Jul 07, 2014 6:20 am

Hi, guys. I'm new with construct 2.

I'm interested on beat em up developing with depth movement like the Simpsons or Teenage Mutant Ninja Turtles 4 players arcade-style.

My player1 is moving, running and attacking correctly but I have problemas with the jump. Player has no behavior, is coded like this:

if key left left: set player.x to player.x-movement
if key left right set player.x to player.x+movement
if key left up set player.y to player.y-movement
if key left down set player.y to player.y+movement

I don't know how to make the jump in this case with CS2. If I use the platform Behavior I have problemas because the whole area is the ground.

Could anyone help me with this, please?

Thanks
B
3
Posts: 8
Reputation: 185

Post » Mon Jul 07, 2014 6:32 am

Hmm, what I'd do is create a jump animation. In each frame, the sprite is a little higher than the last one without you actually having to change it's coordinates manually in an event (of course, when it reaches the top, you make every frame a little lower than the last one). You can add a shadow to the 'floor' of your animation to tell the player at which point in the ground the player will land. Also, you will probably need to modify the bounding box of each frame to wrap around the actual body of the sprite (because if you use the same bounding box throughout the entire animation, enemies will still hit you as if you were on the ground and you won't be able to jump over obstacles either).

I hope I made myself clear
B
6
S
2
Posts: 79
Reputation: 608

Post » Mon Jul 07, 2014 6:49 am

Hi, monitz87. I have tried with a solid shadow with this logic:

forever: set shadow.x to player.x
forever if not jumping: set shadow.y to player.y

The problem with this is I have no idea how to make a "manual jump" without using platform behavior. In other case I would use a repeat loop something like: "repeat X times coor Y-- and repeat X times corr Y ++" but I think CS2 can't put loops inside actions. I know about the logic but I'm new with construct so I have problems making some logic structures. Do you know how could I make this "manual jump"?
B
3
Posts: 8
Reputation: 185

Post » Mon Jul 07, 2014 6:57 am

That's what I was trying to tell you. You create an animation in which the player jumps. Each frame of the animation has the player a little higher than the last one, until he reaches the top, then it goes the other way around.

Something like this:
Image

Each drawing is a different frame of the same animation. The origin (image point 0) stays in the same spot so you can know where in the floor the player is, and you don't need to manually change the sprite's coordinates. When you want to jump, you simply play the animation.
B
6
S
2
Posts: 79
Reputation: 608

Post » Mon Jul 07, 2014 7:12 am

I see, thanks.

But I think construct 2 doesn't allow to move sprites position in animation, so I must icrease image sprite size on each jump frame. Isn't it?

Image
B
3
Posts: 8
Reputation: 185

Post » Mon Jul 07, 2014 7:14 am

yep, the sprite's size increases, but the collision polygon should still wrap the drawing, not the whole sprite. Also, the origin should be the same for the entire animation (I assume you have the origin on the floor)
B
6
S
2
Posts: 79
Reputation: 608

Post » Mon Jul 07, 2014 7:32 am

I didn't know about the col polygon. So this is perfectly solved.
Thanks a lot for your fast and effective help.
B
3
Posts: 8
Reputation: 185


Return to How do I....?

Who is online

Users browsing this forum: Congrats2u, Magistross and 30 guests