Spawn actor and initialyse it
r0bb12
Member Posts: 2
Hi, I've been playing with gamesalad for mac and I would like to know if it's posible to spawn an actor and pass it some parameters on the same time.
Thanks for help.
Thanks for help.
Comments
Just have a series of Change Attributes at the top of the actor being spawned. That way, as soon as it spawns, it will get all the proper parameters before doing any calculations.
Spawner actor:
Change attribute game.counter to game.counter+1
Spawn actor [actor name]
Spawned actor:
Change attribute self.Number to game.counter
But this can also be done with table values. You could have the rows of a table be:
H
E
L
L
O
And then when the counter increments as above, you would have:
Spawned actor
Change attribute self.Letter to tableCellValue(TableName,game.counter,1)
Change self.Image to self.Letter
If you have images in your Library named H.png, E.png, L.png, and O.png, then the code above will spawn actors that spell out HELLO.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User