Help with creating a dodge/roll animation using keypress?

0 favourites
  • 8 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • Hello everyone!

    I am having an issue in the creation of my platformer game - basically, I cannot seem to figure out how to reverse the animation of my character doing a certain action, in this case a dodge/roll sort of thing, when pressing a key (in this case, "0".

    I CAN get the desired results for the one direction, right, but when the character is mirrored and going left and I press "0", it just bounces right again.

    Also, I can't seem to figure out how to get the character to not enter a solid when I do the action near a wall.

    Any ideas? Thank you!

  • Hiya, I guess the player is always at the same angle which is what 'move forward' uses for direction, you are likely using mirrored/not mirrored for the animations. So you can say if looking right(not mirrored?) then move forward 25 pixels, if looking left(if mirrored), move forward -25 pixels. They would be sub events of the press button event.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks, Plinkie! That solves that that one, though I still am having an issue with the Player getting stuck into walls/solids if I do the dodge/roll close to them - any suggestions?


  • Depends what you want to happen in that scenario. If you want nothing to happen then I guess you do another check first, on button press, you can check if the player is overlapping another object 'at offset', so 25 pixels from where the player is currently. If this is true then don't do the roll. You can group all possible solid objects into a family to check against the one object type.

  • True, though I would rather be able to do the roll into the edge of the wall but just not enter it - only because there would be Boss/enemy encounters where I'm sure rolling all around the level will be sort of chaotic.

  • Sounds like the player is a bullet? If you use platform behaviour then collisions are taken care of and you won't go through walls, you will collide with them. Instead of move forward you could use vector x to push the player left and right.

  • Thanks for the suggestion, Plinkie - so, the Player doesn't have any bullet behaviors right now, like you mentioned, just a few platform ones. I did try your suggestion of vector X to push the player, though it only moves a few pixels to either right or left (though DOES take care of the wall issue, which is great).

    Could there maybe be something with the player movement events that would prevent the vector X event from working properly?

    Again, thanks for your help - it's immensely appreciated!

  • Gah, actually I figured it out - you were correct in that using the platform-based events was the right call - for anyone who may stumble across this post, setting the player max speed/acceleration much higher, waiting for 0.2 seconds, then reverting back to normal worked out well.

    Thank you!

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