[HELP]Attack animations

0 favourites
  • 11 posts
From the Asset Store
4 Block Soldiers with different animations, 400x400
  • 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

    <img src="smileys/smiley1.gif" border="0" align="middle" />

  • 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"

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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

  • 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.

  • 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.

  • 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

  • First the Trigger Once is necessary if you're doing state based animations. Second have you checked your animation properties ? Like speed looping etc ?

  • 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 :

    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
    

    (I like using -ing form for boolean... you can really read the capx like a book :D)

  • 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

  • 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

  • Hey,i'm using boolean to idle and attack,and for the rest,i'm using text,thanks guys,now it's working! <img src="smileys/smiley4.gif" border="0" align="middle" />

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)