Animation for diagonal shooting in platformer not working...

0 favourites
  • 6 posts
From the Asset Store
Shoot balls to destroy as many blocks as possible, at each stage the game will become more difficult.
  • Hello, world!

    I am working at a simple Metroid-style game, but I got stuck at the diagonal shooting animation. When pressing the "W" and "D" buttons (the right-up combination), the sprite changes, but it doesn't move. What should I do?

    Here are the events and actions (because I can't put an image unless it's on a site or something):

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    Player, On platform moved - Set animation speed to 15

    Player, Platform is NOT moving - Weapon, Set animation speed to 0

    - Weapon, Set animation frame to 0

    Player, NOT mirrored - Weapon, set animation to Right (play from beginning)

    Player, mirrored - Weapon, set animation to Left (play from beginning)

    Keyboard, W is down

    |- Player, NOT mirrored - Weapon, set animaton to UpR (play from beginning)

    | |- Keyboard, D is down - Weapon, set animation ro DiagonalUpR (play from beginning)

    |

    |- Player, mirrored - Weapon, set animaton to UpL (play from beginning)

    | |- Keyboard, A is down - Weapon, set animation to DiagonalUpL (play from beginning)

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    Note: The "Right" and "Left" animations are ANIMATED, they stop when Player doesn't move, the Weapon being attached to it.

    The "UpR" and "UpL" animations are NOT ANIMATED, they are used when the W key is pressed and Player doesn't move.

    I hope the event sheet is intelligible.

    Thank you very much! :D

  • When you say 'it doesnt move' are you talking about the platform sprite does not move or the animation does not play?

    Are you saying it is working as expected when pressing W and A?

  • The sprite doesn't play, sorry for confusion. And it also doesn't play when the other keys (W and A, as you said) are pressed

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I think I've seen this before. As a logical guess, you have the when W is down checks but they are overridden by the general checks for mirrored/not mirrored, so its trying to play left/right animation constantly as well as the up and diagonal animations, they are basically true at the same time. You need to filter out the general checks for left right with when W is not down.

  • Hello, World!

    After some tries and lots of translates (because I don't know verry well english and I am new to Construct 2 :p ), your advice helped me! Thank you very much.

    For those who have the same problem here is how I did it (my way may differ from what you thought):

    I filtered out the general conditions. For example:

    First, if the player has the variable "diretion" equal to "right"...

    if I press the W and D keys, the sprite changes to the "diagonal right up" sprite

    if I press the D, but NOT the W key, the sprite changes to the "walking right" sprite

    if I press the W, but NOT the D key, the sprite changes to the "facing up right" sprite (a static one, facing right, he looks up)

    if neither W or D keys are pressed, the sprite changes to the "standing right" sprite

    If the player has the variable "direction" equal to "left", we do the same thing, but with A insead of D.

    I don't know if this is the solution you thought, plinkie, but your advice worked.

    Thank you very much! :)

  • Yes, that would be an identical solution.

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