[HELP]Attack animations

Get help using Construct 2

Post » Thu Dec 15, 2011 7:37 pm

Hey guys can u help me?
I'm trying to make my plataform character attack,so,i'm using the following:
-Space pressed          = Set "Attack" true
-Plataform isn't moving =
-Plataform is on floor =
-------------------------
-Is attack              =Set animation to "Attack"
-------------------------
-"Attack" finished      =Set "State" to "Idle"
-------------------------
-"State"="Idle"        =Set animation to "Idle"

but the truth is that the command line doesn't continue after   
-Is attack              =Set animation to "Attack"
because the attack animation stops after the first frame,and this is not an animation problem(i think)cuz' i've tested other animations and the same error ocurred.
So,if somebody knows the problem,please help
Thanks

B
16
S
5
G
1
Posts: 43
Reputation: 1,787

Post » Thu Dec 15, 2011 8:07 pm

have you tried just setting animation to attack when pressed space, if this works its something with your boolean /events

do the animations play if you set them? if not there cant be an "attack finished"
ImageImage
B
61
S
19
G
6
Posts: 809
Reputation: 9,028

Post » Thu Dec 15, 2011 8:23 pm

Like i said,they start to play and stop in first frame
i tried taking off the "after animation finished" event
and doing this:

-space pressed-Play "attack" animation

What happened:
the idle animation comes back to first frame after pressing space(because before using the attack animation,the char was in idle),and the attack animation didn't started at all(WHY?????)

EDIT:Wait,wait,wait,now i know why,the "state" variable,Idle,is activated if thechar is on floor and isn't moving,so,if i do the action of playing the animation,the variable idle will be activated first cuz the char is idle and on floor,so,i can't do this
fmaf2011-12-15 20:28:09
B
16
S
5
G
1
Posts: 43
Reputation: 1,787

Post » Thu Dec 15, 2011 8:29 pm

Just add a Trigger Once While True below your events like

-Is attack
- Trigger Once While True > Set Animation

It is keeping on first frame because this is happening:

Frame n
Is attack ? Set Animation from first frame
Frame n+1
Is attack ? Set Animation from first frame

and so on . With trigger once it triggers just one time.
B
58
S
13
G
10
Posts: 632
Reputation: 12,505

Post » Thu Dec 15, 2011 8:38 pm

Like this?

EV1
Space pressed    = Set "Attack" true
On floor        =
Not moving       =



EV2
Is attack        = Set animation to "Attack"
Trigger once     =

AAHHHHHHH this is so akward,when i do this,a reeeally strange thing happens.
Well,first, tested the game,if i try to press space(attack)the attack animation will play extremely fast,and then,the space button will never work again,that is,that happens only one time,so,i checked the animation speed,and it was seven!So the attack is working one time and extremely fast!!what i did up there was right?
EDIT:Actually,now i think that it's playing the first frame,but now,instead of stucking the animation on first frame forever,the character quickly plays the first frame and comes back to idle.Actually i forgot saying that not just the character used to play only the first frame,the first frame gets stuck on the char,doesn't matter if i jump,walk or run.fmaf2011-12-15 20:57:36
B
16
S
5
G
1
Posts: 43
Reputation: 1,787

Post » Thu Dec 15, 2011 9:01 pm


just do

Space Pressed: set attack true
---is not moving
---is on floor
If animation finished : set attack false

if attack true
---is not moving
---is on floor
-------Set animation to "Attack"

here ya go :D

if this don't fix your problem post the capx file
B
35
S
16
G
16
Posts: 2,222
Reputation: 16,589

Post » Thu Dec 15, 2011 11:36 pm

First the Trigger Once is necessary if you're doing state based animations. Second have you checked your animation properties ? Like speed looping etc ?
B
58
S
13
G
10
Posts: 632
Reputation: 12,505

Post » Thu Dec 15, 2011 11:37 pm

It's weird fmaf.
You have a boolean to tell if you are attacking or not
and a string to name a state.
And also it seems you can have state = "Idle" while Attack is true.
That is a bit incoherent (even if it may work with what kbo said)

So, what I would do is :

[code]System: Start of layout
    -> Player: set idling to true
Keyboard: on Espace pressed
Player: [invert] is moving
Player: is on the floor
    -> Player: set attacking to true
    -> Player: set idling to false
Player: is idling
System: trigger once
    -> Player: set animation to "Idle" (play from begining)
Player: is attacking
System: trigger once
    -> Player: set animation to "Attack" (play from begining)
Player: On animation "Attack" finished
    -> Player: set attacking to false
    -> Player: set idling to true
[/code]

(I like using -ing form for boolean... you can really read the capx like a book :D)Yann2011-12-15 23:38:40
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Fri Dec 16, 2011 1:14 am

Kbdmaster:Thanks,but i already tried that,and it didn't work
Kiyoshi:I already checked the animations,the attack isn't looping and i don't exactly understand the trigger once event,even so,i tried what u said and the results are up there
i'm starting to think that the boolean is interfering with some state variable,probably with the idle state,or with some othe variable.
Thanks guys,i'll try doing what yann is saying,but i'll post my event sheet here so you can pinpoint the problem,thanks,really :D
B
16
S
5
G
1
Posts: 43
Reputation: 1,787

Post » Fri Dec 16, 2011 1:27 am


everthing with " - " is an action


Isn't moving      -Set state=Idle
Is on floor
--------------------------------
State= Idle       -Animation=Idle
--------------------------------
Is moving        -Set state=Walk    
Is on floor
Ctrl isn't down
--------------------------------
State=W alk       -Animation=Walk
                  -Plataform speed 250
--------------------------------
Left arrow down   -Rotate 180 to 180
                  -Set Flipped
--------------------------------
Right arrow down -Rotate 180 to 0
                  -Set not flipped
--------------------------------
On jump           -Set state=Jumping
--------------------------------
State= Jumping    -Animation=Jump
--------------------------------
On fall           -Set state=Fall
--------------------------------
State= Fall       -Animation=Fall
--------------------------------
Ctrl is down      -State=Run
Is moving
Is on floor
--------------------------------
State=Run        -Animation=Run
                  -Plataform speed 350
--------------------------------
Space pressed     -Attack=true
Is on floor
Isn't moving
--------------------------------
Is attack        -Set animation Attack
Trigger once
fmaf2011-12-16 01:28:41
B
16
S
5
G
1
Posts: 43
Reputation: 1,787

Next

Return to How do I....?

Who is online

Users browsing this forum: Kagubro and 23 guests