Using attribute to choose table
Does anyone know how to use an attribute to choose the table to read?
I'd like to set an attribute to indicate the level number. The game would then read the attribute number, and use that to determine which table to read, determining the starting point for each actor. This way, I could build all of my levels into a single scene.
I would think it would look like:
When game.LevelNumber = 1, change game.currentTable to Table 00
where Table 00 equals the name of the table for level 1.
Then:
When game.LevelNumber =1
Change attribute self.Position.X to tableCellValue(game.currentTable,1,1)
Change attribute self.Position.Y to tableCellValue(game.currentTable,1,2)
Not working out -- I suspect it's bad logic on my part. Or can you not use a variable in tableCellValue?
I'd like to set an attribute to indicate the level number. The game would then read the attribute number, and use that to determine which table to read, determining the starting point for each actor. This way, I could build all of my levels into a single scene.
I would think it would look like:
When game.LevelNumber = 1, change game.currentTable to Table 00
where Table 00 equals the name of the table for level 1.
Then:
When game.LevelNumber =1
Change attribute self.Position.X to tableCellValue(game.currentTable,1,1)
Change attribute self.Position.Y to tableCellValue(game.currentTable,1,2)
Not working out -- I suspect it's bad logic on my part. Or can you not use a variable in tableCellValue?
Comments
when you are on lev1 then change it to 1
when level=1
Change attribute self.Position.X to tableCellValue(game.game.level,1,1)
Change attribute self.Position.Y to tableCellValue(game.game.level,1,2)
name your table 1,2,3 etc
dunno if that will work , but I think it will be fine
I can see that the tables folder is not listed in the assets.xml with the sounds, images, behaviors folders
(and those 3 have separate panes in the inspector … wish tables had a pane … instead of sometimes being a pain)
and that assets.xml updates with each sound/image/behavior imported/added
I note that the table is listed in gameAttributes as a Table type
and, in object.xml it is referenced with name as well as id
I have tried everything … including a Table with the table names and ids as cellValues
and adding the folder to the assets.xml (which will not be included when assets is updated)
surprisingly with all my finagling … GS doesn't crash … just ignores me!
I am not upset that we can't do this … or I can get it work … just having Tables is wonderful!
and believe each GS update will expand our ability to access and use them!
@};- MH
on thing I found handy … when table is in GS … saveAs a project that just has the table
then you can open that and reference the table when working in you actual gameProject … without clicking back and forth alot
@};- MH