Arrays in GS
ancch
Member, PRO Posts: 103
Hi!
Does GameSalad support Arrays?
I have 20 X Y coordinates that I need to store.
An array would be best:
X[1] = 200, Y[1] = 350
X[2]= 300, Y[2] = 500
Without arrays, it would be a nightmare to program. I will have to make 20 loops:
If 1 then X1=200, Y1 = 350
If 2 then X2 = 300, Y2=500
very painful. Any good solution?
Does GameSalad support Arrays?
I have 20 X Y coordinates that I need to store.
An array would be best:
X[1] = 200, Y[1] = 350
X[2]= 300, Y[2] = 500
Without arrays, it would be a nightmare to program. I will have to make 20 loops:
If 1 then X1=200, Y1 = 350
If 2 then X2 = 300, Y2=500
very painful. Any good solution?
Comments
I want to make a template do the arrays, the arrays data hold by actor, each actor hold one arrays data, Array[x], because it is hard coded, there is fix size, what the array size you think is best? I don't want to make it too big, maybe 25, 50!
Array Simulation (Demo)
Basically:
1) I have 20 actors (location), each with an attribute named myX and myY.
2) These actors are placed using x = 12+(index*24) where index is a number from 0-19.
3) When a button is pressed, it changes the game.IndexNumber.
4) The picker actor's x-coordinate is constrained to 12+(game.IndexNumber*24).
5) When the location actor is overlapped by the picker actor, it saves its myX and myY to game.currentX and game.currentY.
I know that FPS might be high but that is why I mentioned switches in my description. You could also turn visibility of the actors to off. That can help as well.