Using tables for position

Hey, I know Im close but I cant seem to break through. How would I go about changing the position of an actor using tables in this way: Id like to be able to change the x, and y values by adding or subtracting a value from the next row. So if the x value in row 1, col 1 might be 500, then row 2 might be -200, thus changing the x value to 300. Obviously Id like to do this without having to change the rule other than self time. All x and y values are interpolated at a given time (which will be done using tables as well.

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    I'll attach a demo, but my guess is that you're looking to do something more than just this (click the scene to move the actor):

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

  • satellitessatellites Member Posts: 9
    hey thanks for that :).. I am looking to do something a bit more automated, where I wouldn't have to enter the table row number each time i create another movement of the same actor. im ooking for something like (row 1) + (row 2), then (row 2) + (row 3) and so on. sort of like the number of row = (attribute), then x=(attribute)+1 .. kind of thing..
  • satellitessatellites Member Posts: 9
    actually, more like row 1 + row 2, then row 1 + row 3.. and so on..
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    For each condition that changes the position of the actor (e.g. When [condition] --> change attribute self.position.x), just increase an index value: change attribute game.currentRow to game.currentRow+1. Then, use the expression in my demo but replace the row number with game.currentRow.

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

Sign In or Register to comment.