changing your "waves" with tables
digitalzero
Member, BASIC Posts: 639
right now im trying to get one of my actors to change the table to the next row... for example what i am trying to do is implement a "wave" table and in all of my rows it has a different value for whichever wave it is... for instance for wave one it has a real attribute of 30 row 2 will have one for 32.6 row 3 will have something for 35.8 or something like that... these nunbers i am going to use to change the linear velocity of my characters in the speed they come about using the "change attribute: motion linear velocity x to table cell value (TB waves, row,column)" thanks from some advice from @chakku and @tatiang
now heres where things get a little complicated in the describing process... my wave has a maximum row of 40... when it gets to 40 i would like for it to stay at 40... is there anyway that i can have an actor do this?
sorry im kinda bad at explaing things lol
now heres where things get a little complicated in the describing process... my wave has a maximum row of 40... when it gets to 40 i would like for it to stay at 40... is there anyway that i can have an actor do this?
sorry im kinda bad at explaing things lol
Comments
Change Attribute: self.wave To: min(self.wave+1,40)
So lets try it again.
Change Attribute: self.theRow To: min(self.theRow+1, 40)
Change Attribute: self.waveSpeed To: tableCellValue(TBwaves,self.theRow,1)
Do you have a rule that tests when the next wave should hit? Like this:
When startNextWave is true
--Change Attribute: self.theRow To: min(self.theRow+1, 40)
--Change Attribute: self.waveSpeed To: tableCellValue(TBwaves,self.theRow,1)
And perhaps someone on the other side of the earth will pick it up from here and provide a few more resources for you.
Constrain Attribute self.TableRows to tableRowCount(TableName)
When [attribute] self.TableRows < 40
.....Change Attribute game.CurrentRow to game.CurrentRow+1
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
If the ball hits a platform, rotate it so that it faces the frog
If the ball is moving too slowly, make it drop out of the screen
If the ball drops out of the screen:
.....If there are no lives left, go to game over
.....If there are lives left, reset the scene
Etc. I know it's a silly example but if you can do that for your game, it might help you figure out where things go.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
If you're uncomfortable with tables, try to think of them not just in terms of GameSalad but in terms of what they represent. If you've used Excel or other spreadsheets, Tables are 99% the same as a spreadsheet. So if you have a bunch of cells in rows and columns and you fill them with values, you can refer to them. In Excel, you use the cell name (e.g. B4) which is a combination of the row and column names. In GS, you use the row value and column value. Tables in GS are really used as a database and not as a spreadsheet typically is used, although you can do calculations on the data. So you're just storing data and then retrieving it.
Instead of 15 attributes with 15 save attribute behaviors and 15 load attribute behaviors, you put all 15 values in a table and then use a single behavior to change or save ALL of those values.
But the way you'll get good at using Tables is by using Tables. After a while, you'll figure out what works, what doesn't and what questions to ask.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
basic question: seeing as all rows and columns in tables start at one... how are you able to change the row to row two... you know so basically after a certain amount of time have something that triggers it to go to row 2... i found out how to change the attribute to whatever value it is in that table but how do i use another actor to keep on flowing down the rows using a "time attribute" i have drawn out what i mean so that you can have a clear view of what im doing...
what makes sense to me is this code: every 2 seconds change table (TB waves) row 1, column 1 to (TB waves) row 1 (+1), column 1
but theres no way to do that!
oh and what is change table value attribute... i looked and looked at tutorials from @tshirtbooth to see if theres a clear definiton of what it does and even went to the dictionary (and its not there) to see what it does but im not seeing anything
This is what you are looking for:
Timer (Every) [2] seconds
--Change Attribute: self.theRow To: min(self.theRow+1, 40)
--Change Attribute: self.waveSpeed To: tableCellValue(TBwaves,self.theRow,1)
--Change Attribute: self.linear velocity X To: self.waveSpeed
In this example, it uses an attribute (self.theRow) to tell which table row to access.
The tableCellValue function is found under the second tab/menu in the expression editor.