toggle menu
Categories
Discussions
Dashboard
Sign In
·
Register
Sign In
·
Register
Categories
Discussions
Dashboard
Sign In
·
Register
×
Home
›
GameSalad 101
›
Working with GS (Mac)
2 different enemy images?
ChirpinGames
Member, PRO
Posts:
214
October 2009
edited November -1
in
Working with GS (Mac)
Hey all, just wondering if its possible to have an enemy spawner that after 4 secs randomly spawns one of two different images?
Comments
quantumsheep
Member
Posts:
8,188
October 2009
Yes, yes it is possible.
Have a timer - as you suggested.
Make an attribute - say 'Random Spawn'.
When timer goes off
Change attribute Random Spawn to Random (1,2)
Then have a rule
If attrubute Random Spawn = 1, then spawn actor type 1
If attribute Random Spawn = 2, then spawn actor type 2
That should do it.
Hope that helps,
QS
ChirpinGames
Member, PRO
Posts:
214
October 2009
Fantastic thanks for the help!
Hunnenkoenig
Member
Posts:
1,173
January 2010
How do I make a rule "If attrubute Random Spawn = 1, then spawn actor type 1"?
I can only set true or false if I make a rule with attributes.
firemaplegames
Member
Posts:
3,211
January 2010
You need to use an integer Attribute. When you click the plus sign to add Attributes, make sure you choose Integer.
You use it like this:
Change Attribute
self.myRandomImage to random(1,totalNumberofImages)
Then some Rules like this:
Rule
When self.myRandomImage = 1
Change Image To image1.png
Rule
When self.myRandomImage = 2
Change Image To image2.png
etc...
Hope this helps!
Joe
Hunnenkoenig
Member
Posts:
1,173
January 2010
Super! It worked! Thanks!
To be honest, I used this for spawning bonuses after a collision, but it works fine.
When actor X collides with actor Y, actor Y drops a random bonus from a set of 3 possible bonuses.
Works like a charm.
Sign In
or
Register
to comment.
Comments
Have a timer - as you suggested.
Make an attribute - say 'Random Spawn'.
When timer goes off
Change attribute Random Spawn to Random (1,2)
Then have a rule
If attrubute Random Spawn = 1, then spawn actor type 1
If attribute Random Spawn = 2, then spawn actor type 2
That should do it.
Hope that helps,
QS
I can only set true or false if I make a rule with attributes.
You use it like this:
Change Attribute
self.myRandomImage to random(1,totalNumberofImages)
Then some Rules like this:
Rule
When self.myRandomImage = 1
Change Image To image1.png
Rule
When self.myRandomImage = 2
Change Image To image2.png
etc...
Hope this helps!
Joe
To be honest, I used this for spawning bonuses after a collision, but it works fine.
When actor X collides with actor Y, actor Y drops a random bonus from a set of 3 possible bonuses.
Works like a charm.