Assign different values for each instance using "For each (ordered)"

0 favourites
  • 5 posts
From the Asset Store
Adjusting the game screen for different resolutions (Letterbox scale)
  • I have 4 instances of player indicator's sprites (p1, p2, p3, p4). Everyone is the same sprite, but different frame of the animation.

    I want to use "for each (ordered)" for assigning 4 different global values (Player1, Player2, Player3, Player4; each one stores the current player sprites's UID).

    But I can't simply make an event using "For each (ordered)" on the pin sprites because it will overrite the results if I place each global variables's value in the same event.

    (I know this example will obviously fail. But I want to show explicitly what i'm trying to achieve)

    Writing each Global variable with each player sprites's UID on the Player's pin sprite's variable is the simplest way I can imagine to assign each pin to the corresponding Players.


  • Well. I can't seem to find the "Edit" post... Either it does not exist, or the forum has an horrible UI.

    Whatever, what I'd want to add is (below the image I provided) "PlayerNO" is the PlayerPin (sprite) variable created to store the player's UID, and "Player1/2/3/4" are the global variables that store said UIDs.

  • Well. Actually, THIS is the simplest way I can imagine. But it seems kinda clumsy. Maybe is the way to go. But I would imagine there are more efficient ways to achieve what I meant since my knowledge in programming is almost non existent.

    I had to uploead the pic on a server since the upload image seems bugged/ dont allow me to access the upload prompt... What's the matter with this forum's design anyways? :'(

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • For each set value to "Player"&loopindex+1

    I suggest you use a zero based system.

  • For each set value to "Player"&loopindex+1

    I suggest you use a zero based system.

    Wow. Thanks. I'll give that a try!

    It's nice to have another tool on the shed.

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