move forward,backwards,up or down from current spot and stop

  • I have always had trouble with this and was hoping someone can help me once and for all.

    I do a lot of weird projects that require a sprite to move forward and stop a specific amount of space. For some reason, it either keeps moving or does something crazy I didn't intend.

    Example:

    When clicked, move right 35 pixels and stop.

    I tried something like set y position Self.Y +35..

    This doesn't work..

    Any thoughts?

    Thank you!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Example:

    When clicked, move right 35 pixels and stop.

    I tried something like set y position Self.Y +35..

    This doesn't work..

    Concerning that example, you would have to set X to Self.X +35 to move right.

    set y to Self.Y +35 would move the sprite down.

    I don't see why this wouldn't work.

    Maybe you could attach a link to your .capx to your next post?

    Btw, if you want the sprite to move over time, you can use a variable and lerp.

    If you want to use this and need help, gimme a shout.

  • Yeah, you mean like a grid movement system. There's this old pacman tutorial, on page two it explains how to do that. It's a tricky thing, with sines and cosines and stuff, but the guy explains quite clearly. Mind it's an old tuto tho, may be outdated.

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