Spawn actor can change father attribute
xitpu
Member Posts: 2
First of all, sorry for bad english
Im new on gamesalad and following tutorials i'm starting to write something.
My problem:
I have n actors, for example only ACT1.
I need that each actor shot limit 3 shots at time.
So I add numFire attribute on ACT1 prototype.
RULES ACT1:
Each 0.5 sec, if numFire < 3 I make:
change attribute numFire = numFire +1
Spawn Actor (SHOT actor)
RULES SHOT actor:
At spawn: Move to direction 270 at speed 170, relative to scene
When Attribute self.Posizion.Y < 0:
Destroy this actor
I would like to Change attribute numFire of ACT1 (the father)
Can I change this attribute from SHOT actor ?
Or I have to do each global attribute for each ACT ? (ACT1, ACT2,..., ACTn)
Thanks
Im new on gamesalad and following tutorials i'm starting to write something.
My problem:
I have n actors, for example only ACT1.
I need that each actor shot limit 3 shots at time.
So I add numFire attribute on ACT1 prototype.
RULES ACT1:
Each 0.5 sec, if numFire < 3 I make:
change attribute numFire = numFire +1
Spawn Actor (SHOT actor)
RULES SHOT actor:
At spawn: Move to direction 270 at speed 170, relative to scene
When Attribute self.Posizion.Y < 0:
Destroy this actor
I would like to Change attribute numFire of ACT1 (the father)
Can I change this attribute from SHOT actor ?
Or I have to do each global attribute for each ACT ? (ACT1, ACT2,..., ACTn)
Thanks
Comments
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
you say:
"In your actor that shoots bullets, add the condition When attribute game.bulletCount < game.maxBullets to whatever rule condition you already have.
In your bullet actor, add a Change Attribute behavior at the top of its rules and change game.bulletCount to game.bulletCount + 1. When you destroy a bullet (in that actor or another actor, such as when a collision happens), change game.bulletCount to game.bulletCount - 1. You may also need to create a rule for when the bullet is off-screen (either based on self.Time or self.positionX/Y) and subtract one from the bullet count there are well."
I can understand if I use this technique for the main actor, but if I have 10 or 20 different
actors at time I need to have 10 or 20 different game attribute to check max bullet count for each ones ?
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
I understand the direction to take