Bulldrome
Member
I'm working on a 2D platformer and one of the simple hazards I want are turrets that will fire at simple 45 degree angles (8 cardinal directions). I have it working now but I feel I did it in the most sloppy way possible. I have separate objects for each turret angle but I also have separate objects for each bullet that the turret fires.
So I have a bullet object that fires at a 45 degree angle, a bullet object for a 90 degree angle, a bullet object for 135 degree angle and so on. This works but I feel this could have been done in a lot more efficient way.
This is the code I have on the Alarm[0] event on the turrets
var inst = instance_create_layer(x,y,"Instances",obj_hblastleft);
inst.direction = image_angle;
alarm[0] = room_speed * 3;
and the bullets have simple hsp = *, vsp = * to set their angle to travel
So I have a bullet object that fires at a 45 degree angle, a bullet object for a 90 degree angle, a bullet object for 135 degree angle and so on. This works but I feel this could have been done in a lot more efficient way.
This is the code I have on the Alarm[0] event on the turrets
var inst = instance_create_layer(x,y,"Instances",obj_hblastleft);
inst.direction = image_angle;
alarm[0] = room_speed * 3;
and the bullets have simple hsp = *, vsp = * to set their angle to travel