On Start Instructions and Affecting Actors...

delorianhayzedelorianhayze Member Posts: 55
edited November -1 in Working with GS (Mac)
Hey all. Two quick questions...
1.) Is there a way to have "on level start" instructions. Meaning, something like, "At beginning of level set attributes x and y to 1. Set Attribute score to 001."
2.) Is there a way to obtain/alter data from another actor when editing a different actor? Example: On actor X, I create a rule "accelerate towards", and I want it to accelerate TOWARDS actor Y. OR, while editing actor X say something like, "If actor Y is in animation x, then actor x do x." Essentially i'm looking to see if there's a way for each actor to be able to look at each other's data without having to create game attributes and or use position coordinates (ala accelerate towards).

Many thanks!
DH

Comments

  • troynalltroynall Member Posts: 15
    @delorianhayze

    #1 - i created a "controller" actor. placed it on the screen. then when TIME = 0 seconds. I perform a behavior like CHANGE game.PLATFORM.size.width = GAME_ATTRIBUTE

    #2 - NO. you gotta use game attributes.

    but i did create a TIMING mechanism that also me to CHECK what the GAME ATTRIBUTE I called TIME_SLICE. If TIME_SLICE = 1 then I perform a BEHAVIOR. TIME SLICE uses the GAME'S TIMER. It basically I am grabbing the TENTH of a SECOND unit from the TIMER and then SAVING it to TIME_SLICE. Its a crude timing mechanism but works for me.
  • 3itg3itg Member, PRO Posts: 382
    edited February 2014
    You can use a table and 1 game.attribute. I'll call it "NumberOfUnicorns",
    And on the actors, make "self" attributes and then compare to the table.
    Example:
    Actor: Unicorn
    Change self.ID to game.NumberOfUnicorns+1
    Change game.NumberOfUnicorns to self.ID
    Change self.MyNumber to 10
    Change Table Value
    row = self.ID (this should never be zero)
    column = 1
    Value = MyNumber

    When self.MyNumber does not equal tablecellvalue(Table, self.ID,1)
    Change self.MyNumber to tablecellvalue(Table, self.ID,1)

    When this Overlaps or Collides with actor of type = Unicorn
    Change Table Value
    row = self.ID (this should never be zero)
    column = 1
    Value = MyNumber-10

    or
    if you put your Coords in a table, and you want things to happen in order, base the conditions on... well on your conditions.
    Change Attribute "Score" to 1
    When Score = 1
    change attribute self.position.x to (Table, self.ID,2)
    change attribute self.position.y to (Table, self.ID,3)

    when self.position.x is = to (Table, self.ID,2) & self.position.y is = (Table, self.ID,3)
    Accelerate...

    You are using the game.Attribute to try to make sure each actor has a unique ID, that you can use as reference to data in other places like tables.
    There are also a number of ways you could make one actor "Target" another actor using that unique ID, and change the table values of that target to whatever you want.
    The rule:
    "When self.MyNumber does not equal tablecellvalue(Table, self.ID,1)
    Change self.MyNumber to tablecellvalue(Table, self.ID,1)"
    is an example of watching for a change to table data and responding to it, and in this case, updating from it.
Sign In or Register to comment.