In need of assistance: Working with Actors and the expression 'Random'
Hello everyone,
I am working on my first game and unfortunately, I seem to have come across an obstacle. I am trying to get 1 out of 8 actors be individually selected at random to move from one location to another to perform a few actions and then move to its final location where it will be out of sight and the remaining actors will follow suit.
Here is my situation:
- I have 8 actors (Actors A,B,C,D,E,F,G, and H).
- I have 3 locations (from left to right Location X, Y, and Z).
- All 8 of my actors are at Location Z (all are off to the right of the screen and stacked so they remain invisible until they are individually called forth).
-My Goal: I want to randomly call forth one of my 8 actors and have that actor moved to Location Y. Once the event I have planned for that actor is over, I want that actor to move to Location X so it will be off screen and the next actor can randomly be called forth from Location Z to Location Y and so on until all 8 actors are at Location X.
-My Problem: I managed to get each actor from Location Z to Location Y to do their performances, but they all come out at the same time. None of them acknowledge that I want them to randomly come out one at a time after each one has finished their actions. They come out all cluttered together and I am unable to get them to come out one at a time.
How can I go about doing this?
Any help would be greatly appreciated. ^-^
I am working on my first game and unfortunately, I seem to have come across an obstacle. I am trying to get 1 out of 8 actors be individually selected at random to move from one location to another to perform a few actions and then move to its final location where it will be out of sight and the remaining actors will follow suit.
Here is my situation:
- I have 8 actors (Actors A,B,C,D,E,F,G, and H).
- I have 3 locations (from left to right Location X, Y, and Z).
- All 8 of my actors are at Location Z (all are off to the right of the screen and stacked so they remain invisible until they are individually called forth).
-My Goal: I want to randomly call forth one of my 8 actors and have that actor moved to Location Y. Once the event I have planned for that actor is over, I want that actor to move to Location X so it will be off screen and the next actor can randomly be called forth from Location Z to Location Y and so on until all 8 actors are at Location X.
-My Problem: I managed to get each actor from Location Z to Location Y to do their performances, but they all come out at the same time. None of them acknowledge that I want them to randomly come out one at a time after each one has finished their actions. They come out all cluttered together and I am unable to get them to come out one at a time.
How can I go about doing this?
Any help would be greatly appreciated. ^-^
Comments
For the next actor from Location Z to be "randomly called," the actor that is at Location Y HAS to be finished with its performance and on its way to Location Z.
When an actor is at Location Y, the Player (ex. you or me) will touch a button (different actor) that will cause/trigger the actor at Location Y to perform and then after the actor performs, it automatically leaves Location Y to go to Location X (this part it does well with what I have, but all the actors come out all together at once instead of individually and randomly selected).
AS the actor is "leaving Location Y to Location X," one new actor (from Location Z) is "randomly selected" and it alone moves to Location Y. Then the cycle repeats until all the remaining actors at Location Z have been moved to Location Y and from there to Location X. Once all 8 of the actors are at Location X, I am going to trigger the ending for the game (which I have yet to create since I am still in the process of finishing this part of the game).
Also, do a better random, so they actually differ. Like do something involving random(0, gameclock.millisecond)%5+1 to get a true random from 1-5.
The easiest way to pick which dude is to make a variable in the actor called ID. and when you place them in the world, just change that to 1-8.
Roll your random to randomly select 1-8, and say if randomnum = ID, then I go.
Hope this helps.
http://gamesalad.com/game/55248 (I think this one didn't upload properly)
(2nd one didn't upload properly)
http://gamesalad.com/game/55250 (Here is the same game, 3rd time)
I'm trying to post this for about an hour now. I explained it on text also but it got lost in the proccess.. Forum kept saying my password was wrong.. But I could sign into gamesalad.com with the same password.. And the uploading was just...
Nevermind, just ask any part you don't understand..
@ hotMagic: I will attempt your suggestion. I'm still a bit shaky when using GameSalad since I'm still new, but I will see what I can do.
@ cbt: I'm sorry to say that I'm unable to see the games on any of the links you posted for me. They all show up saying "This game is currently being optimized for the web, please come back in a few minutes." Therefore, I am unable to see the work you did.
Here, a zip file with only including a "gameproj" file.
Arcade is still down.. I hate when these kind of things happen.. I love GS but I also hate it sometimes..
Here is the situation more specifically:
- 8 actors at Location Z (off-screen) are selected individually at random.
- Random Actor A goes from Location Z to Location Y, does a spin when the correct button is touched, then Random Actor A goes to Location X where it is out of sight (the same should happen for the Random Actors B, C, D, E, F, G, and H at Location Z).
- Sometimes when I preview my game, a few of the actors go from Location Y to Location X, touch Location X and then roll/roatate back to Location Y and go back and forth between both Locations until it either stops at Location X, or if it's the last of the actors, it just continues to go back and forth and not stop at Location X.
I have yet to watch all 8 actors successfully make it from Location Y to Location X and I want to be able to end my game when all 8 actors end up at Location X. What do I need to do?
But you mentioned my demo didn't work for you. I highly recommend you reinstall gamesalad. Completely remove it and install again because it was forking for me. It appears something wrong with your GS. That may be the reason from the beginning
I wish Arcade was working and you could have seen my demo. I still don't understand why it is not working for you.