Arrays in GS

ancchancch Member, PRO Posts: 103
edited November -1 in Working with GS (Mac)
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?

Comments

  • victorkin11victorkin11 Member Posts: 251
    No arrays! not now, not sure next version.

    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!
  • ancchancch Member, PRO Posts: 103
    I long for so many things in the next version. Hard coding will be a painful thing.
  • JackBQuickJackBQuick Member Posts: 524
    I would do something like this:

    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.
  • victorkin11victorkin11 Member Posts: 251
    consider FPS, I want 1 actor can handle 25 to 50 data, also GS store any data as string, even it is real number! and when calculation, it convert to number, so only string array can do it all.
  • JackBQuickJackBQuick Member Posts: 524
    @victorkin11 - I was trying to provide an answer to ancch's problem.

    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.
Sign In or Register to comment.