What is wrong here ?! Possible bug ?

0 favourites
  • 5 posts
From the Asset Store
Be quick and choose whether the shown equation is right or wrong.
  • I've encountered a problem when I tried to do the following basic action: To change a character's animation when pressing a key and change it again when pressing the same key again

    Here is a screenshot with my Event Sheet:

    Here is the .capx file: AnimationChange.capx

  • here is your capx altered

    your version says

    if key "X" pressed and mode="anim2" then ... and set mode to equal "anim1"

    if key "X" pressed and mode="anim1" then ... and set mode to equal "anim2"

    so it does the first line and finds "X" pressed and mode="anim2" so changes (animation) and sets mode to "anim1"

    it goes on to now find that "X" is still pressed and mode is now="anim1" (because we have just made it ="anim1" in the last line so it changes the animation and makes modebact to"anim2" again ....

    edit (3rd April,2014) to add picture of events

  • RamPackWobble

    Thanks for your fast answer, but can you explain me what I was doing wrong ? I want to organize my project in groups so when I want to modify something to know where to look.

    Also, If I have more than 2 "modes", how should I structurate the events ?

  • The reason is that when you press "X" player mode 1 triggers true. In this case you Set mode to "Anim2" causing Player Mode 2 to also trigger true right after. Pretty sure that's your problem.

    Its a bit weird setup you have made.

    If you make it like this instead:

    On X pressed

    -------> Player.Mode = "Anim1"

    ------------------ : set Mode to "Anim2"

    -------> Else

    ------------------: Set Mode = "Anim1"

    Then you only need 1 Group to handle the switching for you.

    If you need it to handle more you just add conditions to the Else so:

    On X pressed

    -------> Player.Mode = "Anim1"

    ------------------ set Mode to "Anim2"

    -------> Else

    ---------Player.Mode = "Anim2"

    ------------------ set Mode = "Anim3"

    -------> Else

    ---------Player.Mode = "Anim3"

    ----------------- set Mode = "Anim4"

    -------> Else

    --------- Player.Mode = "Anim4"

    ------------------ Set Mode = "Anim5"

    .. etc

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • RamPackWobble nimos100

    Thank you both very much. I understand now my error (I tried several alternative ways, but what I was missing was Else and a better structure of the events).

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