S
SlFinn
Guest
Hi guys. I have successfully coded my spaceship for my space shooter to shoot lasers when I press the space bar. However I want the lasers to be shot from the space ship automatically and i can@t seem to figure it out. Could somebody please give me some example code to help me? I would really appreciate it.
This is the code i have done for the lasers so far in case you wanted to know:
In my oPlayer step event:
In my obj_laserbullet Create Event:
And in my obj_laserbullet Step Event:
So i have my spaceship shooting via the space bar. But can't figure out how to make it automatic. Please help me if you can, and thanks for taking the time to read this!
This is the code i have done for the lasers so far in case you wanted to know:
In my oPlayer step event:
Code:
if keyboard_check_pressed(vk_space)
{
laser = instance_create_layer(x + 117, y - 1, "Instances",obj_laserbullet);
y -= speed;
laser.speed = 260;
laser.direction = -1;
}
Code:
speed = 260;
Code:
y -= vspeed;