How do I Pick all sprites within range of sprite clicked?

Get help using Construct 2

Post » Sat Feb 28, 2015 11:18 pm

I'm trying to Pick (add to SOL) all Tiles that are within a certain pixel distance all around a Token clicked. Sounds easy right? I've tried System Pick TIle by Eval and Compare using distance() but nothing is working.
Last edited by locohost on Sun Mar 01, 2015 2:03 pm, edited 1 time in total.
B
13
S
4
Posts: 280
Reputation: 1,573

Post » Sun Mar 01, 2015 8:13 am

Have you tried looping through all of the sprites? For each _ _ _
Frosty Elk AB
www.frostyelk.se
Have no fear, We come in peace!
B
13
S
3
G
1
Posts: 106
Reputation: 1,169

Post » Sun Mar 01, 2015 8:23 am

I think its easier to pick them if you convert it to Tile coordinates. That way you can just add integers values as distance to what you want to pick. Here is a very simple example:

Now in this case I have just chosen a fixed point of the table at (2,2) but it would be the same if it weren't fixed, and then I use a Range variable to set the desired range.

Image

So you just have to convert the mouse click to a tile coordinate or the sprite thing you use, which you can do with PositionToTileX and PositionToTileY.

Tilemap.PositionToTileX(Mouse.X)
Tilemap.PositionToTileY(Mouse.Y)
B
44
S
11
G
2
Posts: 1,182
Reputation: 6,828


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 3 guests