Spawning actor
I want to spawn an actor on 5 fixed x cordinate position.I wnat to check wether an emey exist on not in a bounding rectangle.
If no enemy exist on the rectangle than spawn an actor.Any1 knows how to acheive this
If no enemy exist on the rectangle than spawn an actor.Any1 knows how to acheive this
Comments
I may be able to help, but let me clarify first.
You want to spawn actors to 5 fixed positions on screen, but before spawning the actors you want to make sure there is not already an enemy in their positions?
Or you have one actor that will spawn to 1 of the 5 fixed positions. So it will check to see if the first position has an enemy in it, and if it does, it won't spawn the actor there. It will move on to check the next position, and so on, until it finds an open space?
If no enemy present then spawn an enemy otherwise check again.
Basically i dont want my enemies to overlap each other
Create a grid in tables using the x and y locations of your board.
if you had a grid that was 8x8 and each box was 40x40 just make 3 rows in the table
X(real),Y(real),Used(boolean)
in row 1 col 1 set value to 20 (center x of the first box)
in row 1 col 2 set value to 20 (center y of the first box)
in row 1 col 3 leave value unchecked for False. (if sale box is open if true enemy is there)
Do that for each box in your grid
Set a rule in the enemy that changes the table value for that grid column 3 to true
and in your actors to spawn make a If rule that checks the Table value for that grid if that grid location column is false to spawn of true not to spawn.
Good luck
Dan
1st is how can i make actor spawn in fixed random cordinates.
I mean i want the actor to spawn randomly on this X cordinate(26,80,134,188,242)
Currently there is only option of giving min and max value option in random function
Now for the above post
How do i make a grid in gamesalad.This post seems to be extremely confusing to me
Can you make a small demo
Thx
You will put your spawn up like this - tableCellValue( game.TBnem ,1,random(1,5))
The part about making it not spawn where an object is already i am working on at the minute.
but believe that in your scenario … might be easiest if the enemyActor
controls it position after the spawn
Rule: when (All)
Event: overlaps or collides with rectangle
Event: overlaps or collides with actor type (select the prototype)
-changeAttribute: self.Position.X To: tableCellValue(yourTable,row,col)
again you can use random row or column
this change of Position.X will happen rapidly … but you could have the alpha change to 0 when overlapped and 1 when not
example: http://forums.gamesalad.com/discussion/comment/337756
I have made a small rectangle (invisible) and put in all those spawn position
Here is what i wana acheive, whenever the rectangle overlaps or colides with enemy i want the table boolean to set it true and when it doesnt overlap it should be back to false.
However in the change attribute pannel i cant find the option of setting value to true
Any1 knows how to acheive this.
in list of behaviors:
Change Table Value behavior
(don't ask me why it doesn't say changeTableCellValue
selectTable … select attribute or type in Row:/Column:
in Value: type true/false
Change Table Value
right below Change Size behavior
Mac GS
I want actor to spawn if table column value is false.
That is game will 1st randomly select a number from 1 to 5
and then coresponding number coulm value is false
then it should spawn enemy value of that number
However i am not able to acess my table column values while making the rule
Any1 knows any other easier way to do this or any work around
add attribute … boolean type … name something true/false
change the colorAlpha to 0
1st behavior: changeAttribute: self.true/false To: tableCellValue (table?,self.Name,1)
Rule: when
Attribute: self.true/false is true
-Destroy
Otherwise: changeAttribute: self.Color.Alpha To: 1
on spawnerActor:
after the boolean is picked/set in the table
spawn them all
after the boolean is picked/set in the table
spawn them all
Cant understand this
-MH
√ your inbox