Spawn Random Actor/Random Position, Destroy Actors after in place
RastaRise
Member Posts: 52
I have 3 actors (shape, shape2, shape3) and I want them to destroy after they are all in place/on top of (sbox, sbox2, sbox3).
How would I make it so that all of the shapes destroy after they are all put on top of the sbox's? These are 6 separate actors. I am new to this so any help would be great.
The next thing I need help with is I want the game to spawn a random actor in a random position on the top of the screen. Is there a way to do this?
How would I make it so that all of the shapes destroy after they are all put on top of the sbox's? These are 6 separate actors. I am new to this so any help would be great.
The next thing I need help with is I want the game to spawn a random actor in a random position on the top of the screen. Is there a way to do this?
Comments
I did work out a way to do this after another member wanting something similar for their game, but I only did the Rules up to 1; also the screenshot is difficult to follow because you can't see the contents of some fields. (I wish GS would make these wider, cos there's plenty of room to do that...maybe I'll put that into suggestions). Here's the link:
http://gamesalad.com/forums/topic.php?id=7283
Couple of things here: personally I'm still not sure if there's a simpler way to solve this prob; for certain, to do this in a program using some sort of Basic language would take only 2 or 3 lines of code, for sure. At the moment, GS has no arrays attribute, which would open up a range of possibilities, as well as easily solve it.
So I guess that you have to do/consider the following (a few things off the top of my head):
12 new boolean attributes in Scene attributes: Actor1Chosen, Actor2Chosen, etc. set to true
12 new integer attributes in Scene attributes: Actor1Position with 1, Actor2Position with 2, etc.
After each of the 3 actors from the 12 are chosen, all the other actors above in position have to be their position -1.
Similar process for the boxes. And only if a box boolean attribute is set to true, is the appropriate actor destroyed. That'd be realtively easy to do: choose an area, clear of the boxes, where you want the 3 actors spawned. (These actually wouldn't be spawned, technically speaking, but moved by bringing them from "the wings" of the visible screen area). Come in around the perimeter, all four sides, by half the width or depth (whichever is the largest) of the largest actor. Get the min. x & y positions of left and right; same for max. of this new area.
Then as each of your actors is chosen, in their rules, if they are active ("Active" as boolean attribute might be needed, not sure, thinking out loud) change their position x & y, according to random x number + random y number.
Hope you don't think I've been blabbing off here: trying to describe it rather than doing it is a bit difficult. I think it all makes sense, but ideally you need a template to follow. Being new to using GameSalad, I'd relish this/find it interesting to do. Can't promise when I'd get it done if I did, though.
Anyhow, I hope this is of some help for you.
:-)
Ps After all of this, I've just read again something that firemaplegames said:
"CodeMonkey has a demo that shows a way to have random numbers not duplicate themselves." If I found that, I might kick myself.
---------------------------------------------------------------
Spiral Gyro Games
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps