Movement: dodge animation

Get help using Construct 2

Post » Tue Feb 05, 2013 12:39 am

Hi everyone,

I am feeling overwhelmed with movement options, none of which are logically giving me the type of movement I am attempting.

It seems simple in my head: On button pressed (A), character dodges left, waits for a moment, then returns to the original position.

The movement would be very similar to the dodge in Mike Tyson's Punch-Out!!.

Could you help me figure this out? Also, I am not a coder, but would love to understand the logic behind the solution.

Thank you so much!
pinkpassion
B
6
Posts: 13
Reputation: 782

Post » Tue Feb 05, 2013 1:02 am

if you export the capx we could take a look.

You would have to have an idle state, dodge left, and dodge right.
on Button press 'A' => play animation "DodgeLeft", then wait .3 seconds, then play animation idle

on Button press 'B' => play animation "DodgeRight", then wait .3 seconds, then play animation idle
B
32
S
4
Posts: 406
Reputation: 3,221

Post » Tue Feb 05, 2013 1:06 am

Yeah, simply draw the sprite "dodging" to the left or right, and use the play animation to fire off anytime they push the dodge button

You can adjust the collision area of each frame of the sprite on a per frame basis, so adjust it so that its no longer in the middle where they player could still be hit like when he's idle.

B
50
S
21
G
8
Posts: 844
Reputation: 10,299

Post » Tue Feb 05, 2013 1:10 am

Thanks for the reply. I don't have anything worth showing, as I'm unable to replicate the movement without jumping from point to point.

Here's my dilemna more clearly:

Condition: On button pressed (A)

1) Move Player with acceleration, speed, then deceleration to a point (e.g.) 200 pixels to the left,
2) Player stays still for set time,
3) Player returns with acceleration, speed, then deceleration to default position.

B
6
Posts: 13
Reputation: 782

Post » Tue Feb 05, 2013 1:12 am

[QUOTE=justifun]

You can adjust the collision area of each frame of the sprite on a per frame basis, so adjust it so that its no longer in the middle where they player could still be hit like when he's idle.

[/QUOTE]

And that's actually a good idea.

My real difficulty is in getting the character to "slide" left, rather than jump left...
B
6
Posts: 13
Reputation: 782

Post » Tue Feb 05, 2013 1:32 am

Set vector X?
B
49
S
11
G
10
Posts: 1,833
Reputation: 14,428

Post » Tue Feb 05, 2013 2:20 am

Hey! I didn't know about vector!
Platformer was the 1 control method I had not tried (it contains "Vector" movement).

To clarify, in case anyone is looking for similar "dodge"-type movement, this appears to be working for me:

1. Apply Platform behavior to Player sprite (adjust behavior attributes as desired)
2. Events:
   Condition:
Keyboard / On A pressed
   Actions:
/ Player / Set Platform vector X to -5000 (e.g.)
/ System / Wait 1 second
/ Player / Set Platform vector X to 5000

Player dodges (slides smoothly) left, pauses for 1 second, then returns.

Now I need to figure out how to take away player control during the dodge.
Thanks everyone!
B
6
Posts: 13
Reputation: 782

Post » Tue Feb 05, 2013 3:01 pm

For that, there is an action for the platformer behaviors.   I believe it's set controls enabled/disabled.

So at the beginning of press A you would set platform controls 'Disabled' then wait, let it do everything else, and as the last action in the list, you would set platform controls 'enabled'

Can't think of the exact naming of it, but go ahead and try it!
B
32
S
4
Posts: 406
Reputation: 3,221


Return to How do I....?

Who is online

Users browsing this forum: Renfd, supreme676 and 27 guests