Hi!
I'm trying to make level editor where you can place blocks in 150 x 150 px grid. I tried to do event like this:
On click -> Spawn "block" at int(Mouse.X/150)*150 [/code:1nny5x8x] and [code:1nny5x8x]On click -> Spawn "block" at ceil(Mouse.X/150)*150[/code:1nny5x8x] It kinda worked occasionally but most of the time blocks just spawned in wrong places. [b]Edit:[/b] You probably wan't to see pic [img="http://i.imgur.com/NNfT1oC.png"]
Creating the object (not spawning it) at int(Mouse.X/150)*150 should do the trick. I usually make a cursor object that's set to that, then create the tiles at its position.
Develop games in your browser. Powerful, performant & highly capable.
— I changed the origin point of the sprite to top-left and it worked. I also set it to create the object instead of spawning it.