changing your "waves" with tables

digitalzerodigitalzero 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

Comments

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    edited February 2013
    Use a min() function. It will return the minimum of two values. Something like this will keep the value of an attribute (like self.wave) from going over 40:

    Change Attribute: self.wave To: min(self.wave+1,40)
  • digitalzerodigitalzero Member, BASIC Posts: 639
    but @rthurman my waves are in a table... how am i able to call on that in the game?
  • digitalzerodigitalzero Member, BASIC Posts: 639
    @rthurman heres what im talking about... like lets say every 5 seconds i wanna change the row to row+1 so that it will be -35 for the velocity the next time Image and video hosting by TinyPic
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    edited February 2013
    Oh ... I got the impression you were accessing the table rows with an attribute (like self.wave or something). On each new 'wave' you want to go to the next row but not go past row 40 -- right?

    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)

  • digitalzerodigitalzero Member, BASIC Posts: 639
    i have no idea how to work with that code LOL... do you think i can send you my project and you take a look at it... i hope its not too much to ask for and if so can i have your email address
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    You will learn much, much more if you work it out yourself. Keep honing the question down and lets see if we can find the spot that's causing the difficulty.

    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)
  • digitalzerodigitalzero Member, BASIC Posts: 639
    okay that sounds like a plan to me :) im pretty sure im going to be up all night trying to figure this out though lol but i agree with your statement! but am i supposed to use this for the actual characters or for the background... because i want the background to be the trigger for the next wave because the actors that i have for my game will be destroyed and i dont want it to keep on happening lke that... you know what i mean... because the background will never be destroyed
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    edited February 2013
    Unfortunately I will not be able to help much more today. But perhaps you can write out what you want to happen and when (and what actor is supposed to do it). That will help to give you the right info to get started.

    And perhaps someone on the other side of the earth will pick it up from here and provide a few more resources for you.
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Stick this in your wave generation actor:

    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

  • digitalzerodigitalzero Member, BASIC Posts: 639
    thanks so much for your help @rthurman i appreciate your patience with me... @tatiang so am i supposed to make an attribute for the wave trigger named "tablerows" and make a game attribute named "current row"?
  • digitalzerodigitalzero Member, BASIC Posts: 639
    and where do i plug in a timer
  • digitalzerodigitalzero Member, BASIC Posts: 639
    and what would i plug in the actor that is actually moving? and what kinda attributes should i make for these.... sorry i know im a kid with lots of questions lol
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    thanks so much for your help @rthurman i appreciate your patience with me... @tatiang so am i supposed to make an attribute for the wave trigger named "tablerows" and make a game attribute named "current row"?
    Yes. As for your other questions, I'm not really sure how to answer them. Usually, when I'm stuck with a coding task I'm not sure how to do, I start writing out detailed steps like this:

    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

  • digitalzerodigitalzero Member, BASIC Posts: 639
    im usually good about planning things out like this but with the addition of tables and me becoming and looking at tutorials and becoming familiar with them its definitely difficult to get the grasp of things... everything else on gamesalad i have not too much of an issue with... with the exception of most of the things that are in the expression editor such as magnitude and cos and all that stuff lol... im left handed so that part of my brain doesn't really work that well lol but im trying to get the concept of using an attribute to call on a specific row in the game instead of using all types of attributes and having to save them seperately... and besides i would want my game to run smoothly as possible... @tatiang how did you become so familiar with the program or do you have experience with coding as well? because you're a genius in gamesalad lol
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    @digitalzero Thanks... but trust me when I say I'm still learning and I still make mistakes. How did I learn it? I spent a lot of time designing, coding, testing, and fixing things. I also watched videos from people like tshirtbooth who were more knowledgeable than me, and finally I asked a few questions when I was really stuck. My first app took 60 hours of work. My second app took about 40 hours of work. If I add up all of the time I've spent coding in GameSalad, it's probably close to 1000 hours. So it's not going to happen overnight. ;) I'm working on my fourth published app and it's the first that I'm completely proud of and can say I think it's worthy of the App Store.

    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

  • digitalzerodigitalzero Member, BASIC Posts: 639
    THANKS SO MUCH FOR THE ADVICE! it always surprises me how patient people are with me on this forum site and how knowledgeable they are as well... it makes things much easier for me and i think i have a better way of explaining what i need now that i have been trying to figure out my dilema all night LOL

    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...

    Image and video hosting by TinyPic


    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
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    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.
  • digitalzerodigitalzero Member, BASIC Posts: 639
    OMG I GOT IT! wow! thats what i was pretty much looking for and what makes even more sense is that i was looking at @tshirtbooth s tutorial about changing an image based on tables and it gave me a more clear understanding... im finally getting how to use this table stuff... im just going to further my knowledge for like the next couple of hours viewing tutorials and stuff so that it can be jam packed in my mind! THANKS SO MUCH @rthurman and @tatiang
Sign In or Register to comment.