How do I position an object at a tile that the mouse is hovering over?

0 favourites
  • 2 posts
From the Asset Store
Total customisation of the input! You can combine inputs from all peripherals. Make your game accessible for everyone!
  • I am currently attempting to make an aiming system with the mouse that is restricted to the tilemap grid. My goal is to position an object on the tile that the mouse is over, but I can't seem to figure out how to find that tile. I've looked at other posts with similar questions, and saw things like SnapX(x) or PositionToTile(X)x, but I'm not sure how and where to use them. If you could help or have any ideas, that would be appreiciated.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Assuming you have the mouse plugin added.

    mouse.x, mouse.y give actual position.

    Which isn't what you are asking for, but it would be smooth.

    try:

    every tick

    set the sprite to position

    Tilemap.PositionToTileX(Mouse.X)*Tilemap.TileWidth

    Tilemap.PositionToTileY(Mouse.Y)*Tilemap.TileHeight

    It'll be choppy movement, but I believe that's what you're wanting.

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