How do I change instance variable depending sprite instances

0 favourites
  • 2 posts
From the Asset Store
Color Variable
$4.50 USD
10% off
Easily store, modify, read and manipulate colors with Color Variables!
  • 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.

    Example

    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.

    Franzl

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • desiredstatus = 1

    pick all object

    pick object by evaluate where object.spriteX = 1 & object.spriteY = 1

    action

    object.stats = desiredstatus

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)