I have a problem with variables

  • hey hi

    I'm sorry for my bad english.

    When I press a button, it creates a sprite on the page. Each sprite has its own variables. For example, the age-variable of a sprite is "20". The other's "24". I want to do different operations when the button is pressed. But I want each sprite to have a different button. For example, the A button changes the variables of A sprite. Button B changes the variables of the B sprite. If I do it normally, it changes the variables of all sprites on the page. Please help me.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi, try to give your sprites an ID variable that match the button UID, so when you click on a button, you can pick the correct sprite based on this variable :

    On button clicked :

    -Create Sprite at X/Y

    -Sprite : Set ID variable to Button.UID

    Then use the system action "Pick by comparison" when button clicked

  • Hi, try to give your sprites an ID variable that match the button UID, so when you click on a button, you can pick the correct sprite based on this variable :

    On button clicked :

    -Create Sprite at X/Y

    -Sprite : Set ID variable to Button.UID

    Then use the system action "Pick by comparison" when button clicked

    I created variables named "selected variable". they solved the problem with them.

    but i have another problem. When I add new data to Array, it goes like 4 3 2 1 ... instead of going like 1 2 3 4 ... :(

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