Is it possible to specify a table by number and count the rows/columns?

tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
edited January 2012 in Working with GS (Mac)
I have created a 3D maze game (tables are amazing and I can't wait for writeable tables) and I am checking the maze boundaries by counting the rows and columns of the maze layout table for each level. It works great for level 1, but now I am ready to increment game.currentlevelnumber to 2 and I want to count the rows and columns from a different table (e.g. "Level2Maze"). Is there a way to automate this? Here's how I've set things up:

game.playerX is the column value within the maze (so if I started at column 1 and moved "east" one step, I am now at playerX=2).
In a maze with 6 columns, I want the player to not move past the 5th column, as the 6th column is the external wall of the maze.

When attribute playerX = tableColCount(game.Level1Maze)-1 --> do not allow the player to move that direction

So what I really want to be able to do is:

When attribute playerX = tableColCount(table:game.currentlevelnumber)-1 --> do not allow the player to move that direction

New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

Comments

  • GLGAMESGLGAMES SingaporeMember Posts: 988
    i'm making a maze like game with tables too.
    however i have yet to try it but i think my way would be whenever a new level needs loading changed table name to the next level's table name by using a game text attribute. Will try it out myself too later :P
  • GreenHavenGamesGreenHavenGames Member Posts: 62
    Check out Deep Blue Apps recent template on this subject! This is some exciting stuff. If you haven't checked out their site, they have some really great tools available.

    http://www.deepblueapps.com/Deep_Blue_Ideas_Ltd./GSTemplateFR_TBC.html

    In case you're wondering, I am just a happy customer, sharing a valuable tool.

    Sam

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Sam, thanks for the suggestion. I had downloaded that very template and decided to try my hand at maze creation before looking at the template. I was happy with my table-to-3D-maze code, so I went back and checked out that template. While it's very cool, it doesn't address my issue. The template is reading a single table for a single scene. I want to read multiple maze tables for a single scene. In order to do this, I need to be able to either increment a table #/ID or select a table by name. I don't see any way to do that, as my testing of tableCellValue, tableColCount, and tableRowCount return "Invalid Expression" when I try to use a named table such as tableCellValue("MazeLevel1",1,1). Named rows and columns work great... why not named tables?

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

Sign In or Register to comment.