huenix
Member
I an trying to have enemies random spawn AND not over each as well in the holes/walls (they are both "oCollision", with the stage only.
My 3 problems are:
1) if using place_meeting with JUST "oEnemy"; they spread out, but spawn indies holes&walls AND out side of the stage
2) if using place_meeting with JUST "oCollion"; doesn't spawn in "cCollision", but oEnemy over laps with itself AND makes it's own smaller spawning stage
3) if using both together, all negatives happen, small spawning stage (i didn't make), oEnemy over laps with self's and oCollion
My last issues is that only the "y" irandom_range works, but the x crates a smaller range. 112px about.
no mater what i set the x numbers to, they only make their own spawn range the same every time.
the "y" works with the numbers i give it, not matter what i put. ???
im SO confused by that.
(thank you for any help
this is the code as i have it now: (updated from 1st post)
repeat(20)
{
var _xRandomSpawnEnemy = irandom_range(32, 640);
var _yRandomSpawnEnemy = irandom_range(5168, 5776);
while (place_meeting(_xRandomSpawnEnemy, _yRandomSpawnEnemy, oEnemy)) ||
(place_meeting(_xRandomSpawnEnemy, _yRandomSpawnEnemy, oCollision))
{
_xRandomSpawnEnemy = irandom_range(32, 640);
_yRandomSpawnEnemy = irandom_range(5168, 5776);
}
instance_create_layer(_xRandomSpawnEnemy, _yRandomSpawnEnemy,"Enemy",oEnemy);
}
Last edited: