Spawn 2 different actor
wolala123
Member Posts: 249
I have 2 different actor, blue and red actor that want spawn on the screen.
For example, only blue-red or red-blue. I don't want red-red or blue-blue actor on screen. Anyone can guide me? Thanks for it.
Comments
A mysterious question !?
If you want to spawn two different actors you can simply spawn them as normal ?
Like this:
Spawn red actor
Spawn blue actor
Or is there something else to the question ?
A thought . . . .
Maybe you want to spawn them in a random order ? The Blue first, and the Red second . . . or the Red first and the Blue second ?
If this is what you want . . .
Change X to random (1,2)
Rule
When X=1
--Spawn Red
Otherwise
--Spawn Blue
Then in the Red and Blue actors place a spawn behaviour to spawn the other colour (so Red spawns Blue, and Blue spawns Red).
@Socks Oh, sorry. i miss out some information on it.
For example, one unknown actor after collide one of these actor. These 2 actor change random 2 color actor. But these 2 actor must be different color. Blue-red or re-blue , not red-red. Hope can help me this simple thing.
i'm not sure if this is what you want , there are 2 different methods in the attached demo hope it helps.
@Icebox that i want it on my game...thanks for help.
@Icebox sorry for disturbing.....what if i don't want change from blue-red to red-blue actor...
For example, current is A-B after shoot or collide it may possible remain the same A-B not B-A, such as random arrangement. Can you help me ? Thanks.
Go to the switch actor create an integer self attribute call it random
Place a timer every 2 seconds or 1 second (what ever you prefer)
change attribute self.random to random(1,2)
Now in this rule if actor overlaps or collides with Bullet change game.red to not(game.red)
change it and make it like this
Now every 2 seconds if you hit it , it will either be the same , or it will change Red to blue or blue to red
I don't think you need to put change game.red to game.red , just keep it empty and try sorry about that
oh i see...what if i use image as actor, is it same? thanks
I just read this now, sorry for the late reply I'm not sure what you mean , but I'll guess you want to change the image from A to B or B to A , use the same method , but instead of this
" if red is true
change attribute self.color.green to
change attribute self.color blue to
"
change it to
if red is true
change attribute self.image to Red(The name of your png image)
otherwise
change attribute self.image to Blue(The name of your png image)