How do I set up logic for a dodge function?

0 favourites
  • 7 posts
From the Asset Store
100 items casual and logic games. All icons are of a high quality.
  • I'm trying to set up an event when on a key pressed, my side-scroller character will slide out of the way of attacks to avoid damage. The two options that seem to be the best options for this is Platform > Set Vector X, or simply Size and Position > Set X> Neither seem to work the way I would like though.

    With Set Vector X, it only sets the motion for the instance of the keypress, so whether I set it to 600 pixels or six million, it only goes the amount of distance the time the key is pressed allows.

    With Set X, it instantly teleports to the new location. I figured I could lerp it from the current position to current location + the teleport distance, but I have no idea what to call to access an object's current location. Looking in the manual didn't seem to have any info on it.

    SO I'm totally stuck. Any help would be greatly appreciated!

  • I would make a Boolean variable, and while that variable is true, set the x vector to x amount... every tick.

    The Timer behavior would work nicely. Also remember to set input disabled for its duration.

  • Hey, not a bad idea. I'll give it a shot and report back

  • newt Took a bit of doing, but I think I got the basics of something working here!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Looks good.

    Too bad we can't turn off collisions based on an axis. heh

  • Newt, thanks for the to the point solution and summarized wording - almost like a poem.

    tommyoliversays, nice effects/juice! Take for example the enemy closing eyes and explosion animation.

  • Thanks! Just keeping it simple.

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