How do I change instance variable depending sprite instances

Get help using Construct 2

Post » Fri Mar 20, 2015 7:30 am

Hello, I have the following problem.

I have a sprite with many instances.
The instances have the Instant variables spriteX spriteY and status
The instances are arranged as a matrix (array) in the layout and their place in the matrix saved
in the instant variables spriteX and spriteY

Under certain conditions i want to transferred the status from one sprite instance to its neighbor.

Instance No 14 has spriteX = 2 and spriteY = 4 and Status = 2

If the instance with spriteX = 2 and spriteY = 3 have status = 5 (the "northern neighbor"), then the above-described Instance No 14 also get the status = 5

Analog is then compared to see whether one of the other 3 neighbors (to the east, south and west) has the status = 5.
If minimum one of neighbor have status = 5 the first Instance No 14 get status = 5

How this represents in Construct2 code?
I've tried a lot, but no attempt was completely successful.

Thanks for the help.
Posts: 1
Reputation: 354

Post » Fri Mar 20, 2015 3:20 pm

desiredstatus = 1

pick all object
pick object by evaluate where object.spriteX = 1 & object.spriteY = 1
object.stats = desiredstatus
Who dares wins
Posts: 1,878
Reputation: 19,607

Return to How do I....?

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 25 guests