Spawning Question

carlblanchetcarlblanchet Member Posts: 755
edited August 2012 in Working with GS (Mac)
Is it possible to get a spawner to check if an actor is already currently spawned in a location from a table before spawning another actor under it?

Because I have actors spawning randomly from a coordinates table and the actor gets destroyed when clicked, but until it is clicked I want it that no actor can spawn there.

Could I possibly get the row with those x and y coordinates to take itself out when spawned, and actually put the row back in the table when destroyed? If so, how?

Thanks!!

Comments

  • MotherHooseMotherHoose Member Posts: 2,456
    one simple way is to have the actor √ if overlapped or collided with another

    on the spawnedActor:
    set self.Color.Alpha to 0

    Rule: when
    Attribute: self.Time ≤ 0.15
    -Rule: when
    -Event: overlaps or collides with (another actor in that place)
    --ChangeAttribute: self.Position.X To tableCellValue (a randomX)
    --ChangeAttribute: self.Position.Y To tableCellValue (a randomY)
    Otherwise: changeAttribute: self.Color.Alpha To: 1

    image MH
  • carlblanchetcarlblanchet Member Posts: 755
    @MotherHoose Very cleaver solution!! Thank you!! :)
Sign In or Register to comment.