Tables or not?

GuaveMediaGuaveMedia Member, PRO Posts: 1,262
edited July 2012 in Working with GS (Mac)
Hey guys,

does it make sense using tables when reusing actors?
So basically I have a big scene concerning width and the main
actor has to run all the way to finish. In fact of that I have many actors
that can't be seen at the beginning because they are simply out of scene.
To improve performance I thought of resizing old actors that went out of
scene and just put them to the top again. This way I could save a lot of
actors. Hope it makes sense. :D

I always work with the self position X of the main actor. So does it make sense to use tables
for all the positions etc. or is there a more simple way?

All is about keeping the FPS as high as possible.

Thx Alex

Comments

  • AcceleratedGamesAcceleratedGames Member Posts: 201
    You could have this rule:
    If attribute game.MainCharacterPositionX > self.Position.X + (game.Screen.Size.Width/2)+(self.Size.Width/2), then change attribute self.position.X to self.position.X + random(game.Screen.Size.Width*2,game.Screen.Size.Width*10)

    Also, if you want to improve FPS, check out one of my posts from earlier this week.
    http://forums.gamesalad.com/discussion/46652/31-optimization-tips
  • GuaveMediaGuaveMedia Member, PRO Posts: 1,262
    I saw your post and checked all in my game also.
    Thx for the rule but the thing is that we design the complete level
    and don't work with random...so each actor is placed before in the
    complete scene...mhmm
  • AcceleratedGamesAcceleratedGames Member Posts: 201
    Ok, in that case, if the actors aren't moving forward in multipules of a single number, than tables are the only way to do it. If you need help with that part, check out this video @Tshirtbooth made:
  • ericzingelerericzingeler Member Posts: 334
    edited July 2012
    Yes, use tables to reuse actors. The fastest way to go about this is actually very simple:

    Ok, let's say you have an actor prototype with 10 instances. Each instance needs to be unique so it can link to a specific data set in a table. Simply throw all your actor instances in a layer on your scene (organizational purposes only) and rename each one to an integer value. So the first instance name would be 1, second would be 2, and so on.

    Now you can start linking to a table. Example: change self.PositionX to tablecellvalue([table name], self.name, 1). So instance 5 for example, will now get position x from row 5, column 1. I started using the name of the instance because I got tired of creating unique ID attributes inside each instance.

    You can get really deep with tables. Try playing with tablecellvalues within tablecellvalues to get really creative.
  • WildSnakeWildSnake Member Posts: 19
    Try playing with tablecellvalues within tablecellvalues to get really creative.
    Well. Clever idea but how do I address one table from another?
    Meaning is it possible to have my general table ( "levels" ) contain the names for the tables of separated levels ( "level_01", "level_02" etc. ) and later call the appropriate table for every level?

    When I use tableCellValue(table, row, column) is it possible to set "table" variable using some text variable containing table name?

    Thanks!
Sign In or Register to comment.