How do I verify if a tile was touched before

Get help using Construct 2

Post » Thu Feb 11, 2016 5:37 pm

I want to verify if a tile was touched before to allow spawn or not. I know that I need to use a variable to control it, but I don't know how to define the value for each tile. Thanks in advance.
B
74
S
14
G
4
Posts: 1,015
Reputation: 8,133

Post » Thu Feb 11, 2016 6:26 pm

for each tile
if touched = touch = 1
if not touched = touch = 0

it will have to be an object variable
B
29
S
13
G
10
Posts: 355
Reputation: 8,337

Post » Thu Feb 11, 2016 6:33 pm

Thanks @Carbincopy

But I wouldn't to use a loop for this. I want something like:

On touched tilemap & tilemap.tileTouched = false> tilemap.tileAt(something.else.that.I.don't.know): set tilemap.tileTouched = true
B
74
S
14
G
4
Posts: 1,015
Reputation: 8,133

Post » Thu Feb 11, 2016 6:44 pm

RBuster wrote:Thanks @Carbincopy

But I wouldn't to use a loop for this. I want something like:

On touched tilemap & tilemap.tileTouched = false> tilemap.tileAt(something.else.that.I.don't.know): set tilemap.tileTouched = true

Not sure if Tilemap would be able to do that, but you could try compare tilemap at mouse.x mouse.y if touched = true or false, but again you would have to be able to check each tilemap block individually
B
29
S
13
G
10
Posts: 355
Reputation: 8,337

Post » Thu Feb 11, 2016 6:45 pm

I know you could replace tilemap on click with tilemap 2 object
B
29
S
13
G
10
Posts: 355
Reputation: 8,337

Post » Thu Feb 11, 2016 8:44 pm

Ok. I'll wait to see if someone could confirm it or give me another suggestion. Thanks anyway.
B
74
S
14
G
4
Posts: 1,015
Reputation: 8,133

Post » Fri Feb 12, 2016 9:12 am

Some help?
B
74
S
14
G
4
Posts: 1,015
Reputation: 8,133

Post » Fri Feb 12, 2016 6:33 pm

An array would work well to have a value for each tile. Just make it's size the same as the tilemap's number of tiles, horizontal and vertical. To find if a certain tile is touched you can use the expressions in the tilemap to convert the touch's x and y to a column and row.
B
94
S
33
G
117
Posts: 5,387
Reputation: 75,335

Post » Fri Feb 12, 2016 8:39 pm

Thanks, @R0j0hound

I'll try to implement it.
B
74
S
14
G
4
Posts: 1,015
Reputation: 8,133


Return to How do I....?

Who is online

Users browsing this forum: blackhornet, Lancifer and 9 guests