[Solved] Level editor grid

Get help using Construct 2

Post » Tue Mar 11, 2014 7:24 pm

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:
Code: Select all
On click -> Spawn "block" at int(Mouse.X/150)*150

and
Code: Select all
On click -> Spawn "block" at ceil(Mouse.X/150)*150


It kinda worked occasionally but most of the time blocks just spawned in wrong places.

Edit: You probably wan't to see pic

Image
Last edited by Sollaano on Tue Mar 11, 2014 8:52 pm, edited 1 time in total.
B
16
S
5
G
4
Posts: 74
Reputation: 3,311

Post » Tue Mar 11, 2014 8:28 pm

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.
Image
B
243
S
30
G
13
Posts: 1,787
Reputation: 18,770

Post » Tue Mar 11, 2014 8:52 pm

@MadFactory 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.
B
16
S
5
G
4
Posts: 74
Reputation: 3,311


Return to How do I....?

Who is online

Users browsing this forum: R0J0hound and 9 guests