C
chaslinux
Guest
In an alarm[1] event called obj_ufospawner I have the following code:
What's happening is that if ufo_dir == 0 the sprite gets drawn and moves to the right. But if ufo_dir == 1 the sprite doesn't seem to appear.
At first I thought that maybe ufo_dir never equaled one, so I added a room_goto(); function to the else. Sure enough once in awhile I'd be redirected to the room I set in the room_goto(); function.
Direction 180 should be the left heading. Since I created the instance_create() outside of the evaluation I'm thinking it should be working. Feel like I'm missing something very obvious (face palm).
Thanks...
Code:
// set the direction of the UFO
var ufo_dir = irandom(1);
var x_start = 0; // set the x start point
var y_start = random(400) + 60; // set the y start point
if (ufo_dir == 0)
{
direction = 0; // go right
x_start = -16;
}
else
{
direction = 180; // go left
x_start = room_width + 16;
}
alarm[1] = 300;
if(!instance_exists(obj_ufo))
{
instance_create(x_start,y_start,obj_ufo);
}
At first I thought that maybe ufo_dir never equaled one, so I added a room_goto(); function to the else. Sure enough once in awhile I'd be redirected to the room I set in the room_goto(); function.
Direction 180 should be the left heading. Since I created the instance_create() outside of the evaluation I'm thinking it should be working. Feel like I'm missing something very obvious (face palm).
Thanks...