How do I snap a sprite to another sprite?

0 favourites
  • 2 posts
From the Asset Store
Snap to visible grid - perfect solution for any game genre
  • Hia folks,

    I have a sprite which follows the mouse (a "placeholder" for a building to be built). I have placed some invisible sprites on the ground which are meant to be a building base (buildings can only be placed on those bases).

    I want my placeholder to snap to an image point of each building base sprite when the mouse is around. So far, I made a rudimentary system with a simple mouse over condition:

    but the results are buggy at best. The placeholder is snapping, but not always, and not where it should.. I have also checked the collision polygons of both sprites. Made a quick capture below:

    https://i.imgur.com/0g6Bigd.gif

    The white rectangles are the base sprites, they are visible for testing purposes

    Any ideas on a reliable method for snapping to an image point are appreciated!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I have actually solved my issue.

    The condition was incorrect. It wasn't set for the mouse coordinates, but for the placeholder sprite, when I needed to have the placeholder sprite snap when THE MOUSE is over the base sprite...

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