How do I Select one random object from a set in a layout?

0 favourites
  • 3 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • I am working on creating a brick breaker style game, and I would like to make it so that each time a brick is destroyed there is a small chance of one other brick remaining changing to a different colour.

    I only want one brick to change, and only occur each time a brick is destroyed.

    I have tried using an Array, but I cannot figure out how to store the UIDs in the Array and then succesfully pull a random UID from that array and apply a new animation/frame to the object tied to that UID.

    Any help would be greatly appreciated, quite new to all of this so my know how is fairly limited

  • You can do something like this:

    Brick On Destroy 
     Wait 0
    	System Pick All Brick
    	System Pick Random Brick
    		Brick Set color.....
    

    "Wait 0" may not be needed, you can try without it.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You're my hero lol. Been screwing around with Arrays for something so simple

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