How to know how many actor or spawn actor presents in screen .

GamexsGamexs Member Posts: 35
edited December 2013 in Working with GS (Mac)
Hello

i have stuck in one issue , so can we know that how many actor or spawn actor present in screen .

Thanks in advance ..

Comments

  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772
    Add a Integer Attribute called Count. Then in the actor that you want to keep count of add a Change Attribute Behavior that says Count = Count +1. Then each time you spawn one of those actors the Count will increase by 1.
  • -Timo--Timo- Member Posts: 2,313
    just like @jamie_c said. and when you destroy an actor first decrease it with -1 so that count is correct.

    TIP:
    also useful when you need the position for every actor. make a self.attribute and change self.attribute to game.count. and constrain table value to self.position.X inside row:self.integer. also add table row ad the end of the table.
  • Thunder_ChildThunder_Child Member Posts: 2,343
    edited December 2013
    Best answer I can think of is to create a game attribute "integer" called "actor count"...if your using a timer to spawn actors...change attribute to increase +1 per spawn...and then decrease actor count -1 each destroyed actor...then also display text "actor count" this should show how many are in screen at any moment. I have used this but only with timer spawned actors.
Sign In or Register to comment.