How do I match detection and block swapping without arrays?

Get help using Construct 2

Post » Tue Jan 12, 2016 9:22 am

is it possible to implement a system for match detection and block swapping like in common match 3 games without using arrays?
B
12
S
5
Posts: 55
Reputation: 1,060

Post » Tue Jan 12, 2016 9:30 am

Yes, you could use overlapping at offset and some picking with a family I suppose.
B
88
S
30
G
89
Posts: 5,109
Reputation: 60,329

Post » Tue Jan 12, 2016 8:00 pm

how would you do the block swapping? I can change position to a block but how do I tell the program to also reverse position to the near block?
B
12
S
5
Posts: 55
Reputation: 1,060

Post » Tue Jan 12, 2016 8:27 pm

To do that you just need to pick the other block to swap with. This is where the family comes in so you can pick two separate instances of the block. Basically create a family, call it "other" and add the block type to it. So for example if you wanted the block you click on to swap with the block to the right you could do this:

global number tempx=0
global number tempy=0

on right clicked on block
other: x = block,x+32
other: y = block.y
--- set tempx to block.x
--- set tempy to block.y
--- block: set position to (other.x, other.y)
--- other: set position to (tempx, tempy)
B
88
S
30
G
89
Posts: 5,109
Reputation: 60,329


Return to How do I....?

Who is online

Users browsing this forum: dokthor, JaredX, Monkin8r and 12 guests