W
Wild_West
Guest
What I thought would be easy to do for one of the last 10 monsters I need to complete my line up for the game was a little bug that spawns more bugs and the spawned ones would move around the center bug in a range of 200 pixels, acting as the nest_radius which is drawn in red in the image, and just move in random directions.
Trouble is despite mimicking the same exact thing I've seen done before I can't get these 2 functions to work how I need.
The bugs just all start at the same position and fly off, outside the radius.
So what am I messing up here because I can't see it.
if( distance_to_object(player) < 200 )
{
spawn_rate += 1;
if(spawn_rate = 20) and ( instance_number(hive_bug) < nest_number)
{
swarm = instance_create(x,y,hive_bug);
swarm.speed = 10;
swarm.direction = random(270);
swarm.x = x + lengthdir_x(nest_radius,direction);
swarm.y = y + lengthdir_y(nest_radius,direction);
spawn_rate = 0;
}
}
Game Bug is the spawner in the middle of the "Hive" red circle, and the hive bug is the one on the 0 degree area of the circle.
Trouble is despite mimicking the same exact thing I've seen done before I can't get these 2 functions to work how I need.
The bugs just all start at the same position and fly off, outside the radius.
So what am I messing up here because I can't see it.
if( distance_to_object(player) < 200 )
{
spawn_rate += 1;
if(spawn_rate = 20) and ( instance_number(hive_bug) < nest_number)
{
swarm = instance_create(x,y,hive_bug);
swarm.speed = 10;
swarm.direction = random(270);
swarm.x = x + lengthdir_x(nest_radius,direction);
swarm.y = y + lengthdir_y(nest_radius,direction);
spawn_rate = 0;
}
}