How do I add hit and sit actions using "platform behavior"?

Just started using Construct 2? Post your questions here

Post » Wed Apr 20, 2016 12:27 pm

Hi! I am beginner in construct 2 and in gamedev also.

I'm making simple game: 2D platformer fight where both players can perform next actions: move, jump, sit and attack (both during jump and stand).

l'm using "spriter" to make animations.

I've already made movement (move and jump) using video "Using Spriter animation files in construct2" (i've made the same events).
And now i have problem with adding sit and hit animations.

Events like "Player is on floor & hit button pressed -> set animation to "hit" doesn't work, sprite just standing. (it looks like he begins to play hit animations, but immediately begin to play stand animation). I've spent several hours and don't know what to do and i'm looking for help :(

Thanks in advance! (and sorry if there are already this question on forum)
B
3
Posts: 3
Reputation: 181

Post » Wed Apr 20, 2016 12:49 pm

How do you trigger the 'stand animation' ? Is the condition that makes it start to play kinda always true ?
B
33
S
18
G
27
Posts: 2,433
Reputation: 20,330

Post » Wed Apr 20, 2016 3:43 pm

Event:system vector(x)=0, player is on floor, animation not equal stand. Action: set animation to:stand from current ratio (as in tutorial:)
B
3
Posts: 3
Reputation: 181

Post » Wed Apr 20, 2016 4:28 pm

So the answer to my question is YES, kinda.
You have to learn to read your conditions, you need to know when they are true.

The standing animation runs when v=0 (speed is zero), when the platform is on the floor and when idle is not playing. Those conditions are still all true when you press a key. So at the moment, when you trigger a hit animation you also trigger a stand animation.

This means that the trigger for the stand animation needs a condition more to stop it from playing during the hit animation. You know how to do that, you did it allready whit the idle animation.
B
33
S
18
G
27
Posts: 2,433
Reputation: 20,330

Post » Wed Apr 20, 2016 6:45 pm

I had this same problem in my game and I got around it by adding an instance boolean to the player sprite called overrideAnimations and then testing to see if it wasn't true. eg

if player is on floor & overrideAnimations = false : set animation to "Stand"

player presses "hit" key: set overrideAnimations to true, play animation "Hit"
animation "Hit" is finished: set overrideAnimations to false
Image



Coming soon on Steam!
B
16
S
9
G
3
Posts: 201
Reputation: 3,460

Post » Thu Apr 21, 2016 9:41 am

Thank you for help! Now i make hit animation during standing (using your advice) and i even make hit during jump using the same thing (but somehow it doesn't work when flipped - but it's lesser problem).

Main problem is i cannot make hit during walk. I've tried the same method but it doesnot work.

Walk event is next: player1VectorX>0, player1 is on floor, animation not equal to "hitwalk". Action: set animation to walk
Hitwalk event: player1 is on floor, space pressed. Action: set animation to hitwalk.

I think the problem is in conditions again but i dont know where..

p.s.
Maybe you can give advice how to understand conditions better? Because now i can make something works
only using tutorials and videos. When i try to make something myself it doesn't work in 90% of cases :?
B
3
Posts: 3
Reputation: 181


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 3 guests