How do I detect which direction a sprite is being dragged?

0 favourites
  • 5 posts
From the Asset Store
Hand-animated Sprite Base for isometric game/animation development
  • Hi, sorry if this has been answered somewhere, I couldn't find it with the searches I put in..

    I'm trying to detect if a dragged sprite is basically being dragged either to the left, right, up or down.

    So as an example imagine a sprite with 5 frames:

    0: dot

    1: right arrow

    2: left arrow

    3: up arrow

    4: down arrow

    If you drag the sprite to the right, I'd want to detect that and tell the sprite to go to frame 1

    alternatively if you drag the sprite up, to go to frame 3 etc.

    Any advice or tips would be greatly appreciated!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • [deleted link]

  • That's a pretty nifty way of going about it, I'll play around with that in my project thanks!

  • You can always check a sprites position X and Y.

    You can also check angle facing and if a bullet you can check angle of motion.

    Any of those can be used to determine which direction a sprite is moving or will move next.

  • I was trying to figure it out via X and Y but wasn't sure how to do it relatively to the sprites current position.

    I'll try making it a bullet and see if that is any better than the way MPPLant suggested, thanks

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