random spawn actors with an exception
Hi all, i would like to use the random function to spawn random actors, the numbers would be from 1 to 10 (min 1, max 10) but i don't want to spawn number 5, so from one to ten except number 5, is this posible???? How can i do this?
Comments
I explain my case: i have for actors which spawns randomly in my game, and everytime i kill one my game spawn an actor (randomly) but with an exception of the last killed actor, so it is a random spawning but i don't want to spawn the last killed actor, wich could be anyone from 1 to 4... I know how to do this in code programing but i don't know how to do it in GS
1. dont use spawn make one actor and add a self attribute like selfID and set it to integer and another attribute name it "randomizer" and set it to integer as well.
2. place 10 actors in the scene and change each selfID value from 1-10
3. now using the self.selfID attribute of your actor you can use interpolate or change attribute to move them in your scene (depends on how your game works).
4. make a global attribute "killMonsterID" and set it to integer.
5. make a rule in your actor like this.
>>if collide with bullet & selfID = 1
change attribute killMonsterID = 1
6. now on your spawning(or moving) rule on your actor do this.
>>change attribute randomizer = random (1,10)
>>if randomizer = killMonsterID
then >> change attribute randomizer = random(1,10)
Thats how i did mine on one of my project but i did hold for a while coz having 80+ actors (with rules) in the screen is not healthy for GS even when you dont have any physics. Some rules skipped even in iPhone4. Sorry if its a bit cloudy i dont have any mac here in the office