How do i change the value of an instance value individualy?

0 favourites
  • 2 posts
From the Asset Store
Simplistic hyper-casual game with nature elements. Tap to switch between the 4 elements and reach a better score.
  • I have a game where a sprite has 3 instance variables (A,B andC) with a randomized value from 0 to 8.

    i want it so that when the sprite is selected, and a global variable (named hold) is equal to any of those three values, it sets that specific value to 0

    I tried and it sets every single instance variable to 0 not just the one it equals to

    example:

    there a re 2 instances of that sprite

    1 has A1 B3 C4

    2 has A4 B7 C8

    when hold=1 it sets both A values to 0 like this

    1 has A0 B3 C4

    2 has A0 B7 C8

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You need to use "Sprite compare instance variable" condition. Something like this:

    Mouse On Clicked Sprite 
    
    .. Sprite compare variable A=hold : Sprite set A to hold
    
    .. Sprite compare variable B=hold : Sprite set B to hold
    
    .. Sprite compare variable C=hold : Sprite set C to hold
    
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)