Spawning Random Actors in a Specific Location
Hello!
I have been having trouble spawning new actors in 2 particular locations (I have 2 sets/groups of actors for each location and they don't mix -- For example: one location for random numbers and one for random letters). I have my game set so that when the main menu scene changes to the game scene, 2 random actors (one from each set/group) automatically spawn in the 2 particular locations I have set up (1 for each of them -- I have these 2 particular locations through use of constrain attributes). Also, I have set up a rule so that when 2 particular actors are in each of the 2 locations at the same time, each of the 2 locations will spawn a new actor. It works fine, except for that it doesn't get rid of the first 2 previous actors at those locations. What do I do to get rid of the first 2 random actors so that the new 2 actors will spawn without the first 2 actors behind them?
Here is my set-up:
-------------------
Location A Actor:
Constrain Attribute: self.Position.X To: game.SpotX-46
Constrain Attribute: self.Position.Y To: game.SpotX-65
Rule: When game starts, spawn a random actor in this Location.
Attribute: game.PlayGame is true
-Constrain Attribute: RandomActorSlotA To: random(1,12)
-Rule: Attribute: game.RandomActorA = 1
Spawn Actor: Actor 1
Layer Order: Front of layer
Relative to: Scene
Position: game.SpotX-46 and game.SpotY-65
-Rule: Attribute: game.RandomActorA = 2
Spawn Actor: Actor 2
Layer Order: Front of layer
Relative to: Scene
Position: game.SpotX-46 and game.SpotY-65
(Continues all the way down to 12)
Location B Actor:
Constrain Attribute: self.Position.X To: game.SpotX+46
Constrain Attribute: self.Position.Y To: game.SpotX-65
Rule: When game starts, spawn a random actor in this Location.
Attribute: game.PlayGame is true
-Constrain Attribute: RandomActorSlotB To: random(0,11)
-Rule: Attribute: game.RandomActorB = 0
Spawn Actor: Actor A
Layer Order: Front of layer
Relative to: Scene
Position: game.SpotX+46 and game.SpotY-65
-Rule: Attribute: game.RandomActorB = 1
Spawn Actor: Actor B
Layer Order: Front of layer
Relative to: Scene
Position: game.SpotX+46 and game.SpotY-65
(And so on...)
Basically from here on, I have a Button Actor with a rule that says that if there are 2 particular actors in each location at the same time, then the Change rule kicks in. I have a boolean attribute called game.ChangeTime and it is supposed to spawn a new actor in each of the 2 locations, which it does, but it doesn't hide/remove the previous two actors in those spots.
Button Actor:
-Rule:
Attribute: game.RandomActorA = 12
Attribute: game.RandomActorB = 0
Change Attribute: game.ChangeTime To: 1
Then I have the exact same code as Location A Actor and Location B actor (because I simply copied the code within the same actor), but in place of game.PlayGame, I inserted game.ChangeTime and it works well, but again, it doesn't hide/get rid of the 2 previous actors.
What do I do?
Any help would greatly be appreciated!
I have been having trouble spawning new actors in 2 particular locations (I have 2 sets/groups of actors for each location and they don't mix -- For example: one location for random numbers and one for random letters). I have my game set so that when the main menu scene changes to the game scene, 2 random actors (one from each set/group) automatically spawn in the 2 particular locations I have set up (1 for each of them -- I have these 2 particular locations through use of constrain attributes). Also, I have set up a rule so that when 2 particular actors are in each of the 2 locations at the same time, each of the 2 locations will spawn a new actor. It works fine, except for that it doesn't get rid of the first 2 previous actors at those locations. What do I do to get rid of the first 2 random actors so that the new 2 actors will spawn without the first 2 actors behind them?
Here is my set-up:
-------------------
Location A Actor:
Constrain Attribute: self.Position.X To: game.SpotX-46
Constrain Attribute: self.Position.Y To: game.SpotX-65
Rule: When game starts, spawn a random actor in this Location.
Attribute: game.PlayGame is true
-Constrain Attribute: RandomActorSlotA To: random(1,12)
-Rule: Attribute: game.RandomActorA = 1
Spawn Actor: Actor 1
Layer Order: Front of layer
Relative to: Scene
Position: game.SpotX-46 and game.SpotY-65
-Rule: Attribute: game.RandomActorA = 2
Spawn Actor: Actor 2
Layer Order: Front of layer
Relative to: Scene
Position: game.SpotX-46 and game.SpotY-65
(Continues all the way down to 12)
Location B Actor:
Constrain Attribute: self.Position.X To: game.SpotX+46
Constrain Attribute: self.Position.Y To: game.SpotX-65
Rule: When game starts, spawn a random actor in this Location.
Attribute: game.PlayGame is true
-Constrain Attribute: RandomActorSlotB To: random(0,11)
-Rule: Attribute: game.RandomActorB = 0
Spawn Actor: Actor A
Layer Order: Front of layer
Relative to: Scene
Position: game.SpotX+46 and game.SpotY-65
-Rule: Attribute: game.RandomActorB = 1
Spawn Actor: Actor B
Layer Order: Front of layer
Relative to: Scene
Position: game.SpotX+46 and game.SpotY-65
(And so on...)
Basically from here on, I have a Button Actor with a rule that says that if there are 2 particular actors in each location at the same time, then the Change rule kicks in. I have a boolean attribute called game.ChangeTime and it is supposed to spawn a new actor in each of the 2 locations, which it does, but it doesn't hide/remove the previous two actors in those spots.
Button Actor:
-Rule:
Attribute: game.RandomActorA = 12
Attribute: game.RandomActorB = 0
Change Attribute: game.ChangeTime To: 1
Then I have the exact same code as Location A Actor and Location B actor (because I simply copied the code within the same actor), but in place of game.PlayGame, I inserted game.ChangeTime and it works well, but again, it doesn't hide/get rid of the 2 previous actors.
What do I do?
Any help would greatly be appreciated!

Comments
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
@Diana if you just want to let them go away then change there alpha to zero and follow the video FBS post
CAlvin
EDIT: beat by T again
@FryingBaconStudios: I checked out the video, but it displays moving actors that spawn. My actors that spawn are stationary and stay in the particular locations.
@tshirtbooth: I am trying to create a game where the player has to move the hands of a clock to the time that is displayed in a digital-like clock (ex. 12:05). Instead of using Display Text to display hours and minutes, I created images of the hours (1 through 12) and minutes (by 5's -- 00 through 55). I have the hands on the clock moveable to the player and a digital-like clock showing what time the player needs to set the clock to. Once the player has the clock hands in place, the player then clicks the "check" button, it tells the player if he/she is right. If the player is right, I have a rule that triggers the spawning of 2 new time actors (1 hour and 1 minute) in place of the previous two. Unfortunately, the first two actors don't disappear when the new two actors spawn forth.
For example: The time displayed is 12:05, 12 is in Location A and 05 is in Location B. When the player correctly sets the hands of the clock in place and clicks on the Check button, 2 new actors would spawn (ex. 3 and 00) in place of actors 12 and 05 (3 would take place of 12 and 00 would take place of 05).
I want new actors to spawn each time the player is correct.
@calvin9403: I have already set up the spawning rule, but I'll look into the alpha to zero.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
gameAttribute index-type timeIsCorrect =0
on the prototype handActors:
Rule: when
Attribute: game.timeIsCorrect = 1
--Destroy this actor
on the Button to √:
in the rule for checking if Player has it right … add::
--changeAttribute: game.TimeIsCorrect To: 1
newRule: when
Attribute: game.TimeIsCorrect = 1
--Timer: After: 0.1 seconds
---changeAttribute: game.TimeIsCorrect To: 2
newRule: when
Attribute: game.TimeIsCorrect = 2
--your Spawn & digital clock behaviors
--changeAttribute: game.TimeIsCorrect To: 0
hope this works for you!
@};- MH
@MotherHoose: I just tried what you suggested and I still have the previous actors there even after the new ones spawn up. It was a good idea though. I'm wondering if there's anything I can do to tweak it. I noticed that the only time there's an actor by itself in each slot is when it is randomly selected a second time in row. I have the HourSpawner that spawns one of the random hours in its spot (on top of it) and the MinuteSpawner that spawns one of the random minutes in its spot (on top also). Would I need to make a switch/gate-like attribute so that it notifies the other actors that there is an actor in HourSpawner and not to send in another until HourSpawner is empty? Same for MinuteSpawner? If so, how would I go about doing it?
OSTimedemo from the new file browser