Drag by events

Get help using Construct 2

Post » Wed Apr 01, 2015 3:48 am

Hello guys.

How do I drag sprites by events.
Last edited by derikvlog on Fri Aug 07, 2015 11:55 am, edited 4 times in total.
B
11
S
1
Posts: 86
Reputation: 1,093

Post » Wed Apr 01, 2015 4:25 am

If you want the position of your sprites to constantly snap to a grid as you drag them, then you can set the position of the sprites every tick to something like this:

X: round(Sprite.X / TileWidth) * TileWidth
Y: round(Sprite.Y / TileHeight) * TileHeight

TileWidth and TileHeight being whatever size you want your grid squares to be.

Alternatively, if you want smooth dragging, but for the final positions to be snapped to a grid, you can set the sprite's position to the above formula upon the object being dropped.
Moderator
B
104
S
39
G
19
Posts: 1,584
Reputation: 18,167

Post » Wed Apr 01, 2015 1:35 pm

Thank you, it worked!
B
11
S
1
Posts: 86
Reputation: 1,093


Return to How do I....?

Who is online

Users browsing this forum: Thndr, xrosax and 11 guests