Spawned actors and animate image

glyniusglynius Member Posts: 231
edited August 2012 in Working with GS (Mac)
Hi everybody,
i want to throw some actors using touch, when this actor reaches a specific speed i want to animate the image,
so far so good, the problem is that this actor is spawned, so if i change the image, it changes to all of the spawned actors,
is there any way to treat each spawned actor separately?

Comments

  • MotherHooseMotherHoose Member Posts: 2,456
    edited August 2012
    yes …

    one way:
    give each spawned actor a unique name at runTime

    gameAttribute: index type … spawnCount

    on your touchActor that does spawn
    Rule: when
    Event: touch is pressed
    Attribute: game.spawnCount ≤ the maximum number of spawns you want
    -changeAttribute: game.spawnCount To: game.spawnCount+1
    - do the spawn

    on spawnActor:
    1st behavior: changeAttribute: self.Name To: spawnCount
    Rule: when
    Attribute: self.Name is 1
    -changeAttribute: self.Image To: image name (do not need to use .png)
    -Rule: when
    -Attribute: self.Motion.Linear Velocity.X ≥ ???
    --Animate (drag in the image for #1 animation)

    … rules for each of the spawns (when self.Name = 2; etc.)

    image MH
  • glyniusglynius Member Posts: 231
    Thanks MotherHoose, seems to work, i have a messed project now, but i will start from scratch applying what you suggest. Thank you very much!
Sign In or Register to comment.