Need help with tables and some actions!
luckyleaf
Member Posts: 7
Hi. everyone
Im making a game a bit like subway surf.. but here things come from the right and moves to the left..
i have build 5 actors "5 Lanes" that my player can move in..
made 5 game attributes with the names lane1,lane2, lane3, lane4,lane5
my idea is that the table will have 5 rows, one for each lane
and a collum is "one" spawn sek..
so in the table the will be numbers, each number stands for either a positive spawn, negative spawn, or a "empty" spawn.
this is my table ex:
("-" is a new collum) Collum
lane1 1 - 2 - 1 - 3 - 1
lane2 5 - 5 - 5 - 4 - 1
lane3 1 - 1 - 2 - 2 - 2
lane4 2 - 3 - 3 - 3 - 2
lane5 4 - 1 - 1 - 1 - 4
lets say the #1 is a cannonball, or #number 2 is a powerpickup, or that #5 is nothing.
now what i wont is to tell directly to the lane actor or the game attribute for the lane, to spawns what is equal to that collum # that sek.. and then the sek after spawn the thing in the next collum...
the Actor spawner will have the, spawn set to.. if game attribute "lane1" number is equal to 1 spawn this item..
hope you guys can understand what im trying to write here :S
Im making a game a bit like subway surf.. but here things come from the right and moves to the left..
i have build 5 actors "5 Lanes" that my player can move in..
made 5 game attributes with the names lane1,lane2, lane3, lane4,lane5
my idea is that the table will have 5 rows, one for each lane
and a collum is "one" spawn sek..
so in the table the will be numbers, each number stands for either a positive spawn, negative spawn, or a "empty" spawn.
this is my table ex:
("-" is a new collum) Collum
lane1 1 - 2 - 1 - 3 - 1
lane2 5 - 5 - 5 - 4 - 1
lane3 1 - 1 - 2 - 2 - 2
lane4 2 - 3 - 3 - 3 - 2
lane5 4 - 1 - 1 - 1 - 4
lets say the #1 is a cannonball, or #number 2 is a powerpickup, or that #5 is nothing.
now what i wont is to tell directly to the lane actor or the game attribute for the lane, to spawns what is equal to that collum # that sek.. and then the sek after spawn the thing in the next collum...
the Actor spawner will have the, spawn set to.. if game attribute "lane1" number is equal to 1 spawn this item..
hope you guys can understand what im trying to write here :S
Best Answers
-
tatiang Posts: 11,949By "sek" do you mean "second?"
Each lane spawner actor can have a timer that runs every second and increases its self.column (integer) value and then spawns an actor based on tableCellValue(tableName,self.myRow,self.column).New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
-
tatiang Posts: 11,949In each spawner actor, create the following attributes:
self.column (integer) set to 0
self.spawnChoice (integer) set to 0
self.lane (integer) set to the lane number where that actor is (e.g. 1, 2, 3, etc.)
In each spawner actor, create the following timer:
Timer every 1 second
change attribute self.column (integer) to self.column+1
change attribute self.spawnChoice (integer) to tableCellValue(tableName,self.lane,self.column)
When attribute self.spawnChoice=1
Spawn actor [cannonball]
When attribute self.spawnChoice=2
Spawn actor [powerpickup]
etc.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Answers
i'm a new user so, a little push in the right direction would be nice
if you have the time..
tried with what you gave me in your post, but can figure it out..
thanks for your help so far!
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
But what if i what to loop the table.. so when it hits the last collumn, it restarts again at the first column?
change attribute self.column to mod(self.column,tableColCount(tableName))+1
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User