0 Favourites

Set a global variable as an object

  • For an example, I have 100 sprites(S1,S2,S3... S100), and a global number "n". The "n" could be a random number from 1 to 100. Is there a way to set a position as S"n".X, S"n".Y in Construct 2? Any suggestions would be greatly appreciated!

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • not sure if it will work like that but this maybe helps

    system 'for each sprite' and then system expression 'loopindex'

    loopindex gives you the number of current loop

    so you could say in the for each loop , set position Sprite.x * loopindex and sprite.y * loopindex so sprite 1 will be x0 y0 sprite2 x10 y10 sprite3 x20 y20

  • not sure if it will work like that but this maybe helps

    system 'for each sprite' and then system expression 'loopindex'

    loopindex gives you the number of current loop

    so you could say in the for each loop , set position Sprite.x * loopindex and sprite.y * loopindex so sprite 1 will be x0 y0 sprite2 x10 y10 sprite3 x20 y20

    Thank you for the idea!<img src="smileys/smiley4.gif" border="0" align="middle" /> but what I hope to find out more is the way to represent a variable with combination of a global variable and text.

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