D
Daniel Hall
Guest
Hi,
Im new to gamemaker, and followed the tutorial for making an asteroids clone in GML (From yoygames youtube channel).
Thats all fine, but I am now trying to edit it so that instead of a single bullet from the center of the spaceship, i want two bullets, one from each side (i created a sprite with two little guns). Ive tried figuring it out, and searching for solutions (I tried to just offset the 1 gun to start with). The below code does offset it, but the offset switches sides when rotating the ship.
The code I have for the bullet spawn (as a step event on the ship obj) is:
var _yy = y + lengthdir_y(20, image_angle);
var _xx = x - lengthdir_x(8, image_angle);
bullet1 = instance_create_layer(_xx, _yy, "Instances", obj_bullet)
bullet1.direction = image_angle;
Can anyone advise?
The example from the GML reference pages made it sound like it would work "This will create a bullet instance at (_xx, _yy), which will be 64 pixels from the parent instance in the direction of the image angle."
Im sure im just missing something stupid, enjoying my time with it though
Im new to gamemaker, and followed the tutorial for making an asteroids clone in GML (From yoygames youtube channel).
Thats all fine, but I am now trying to edit it so that instead of a single bullet from the center of the spaceship, i want two bullets, one from each side (i created a sprite with two little guns). Ive tried figuring it out, and searching for solutions (I tried to just offset the 1 gun to start with). The below code does offset it, but the offset switches sides when rotating the ship.
The code I have for the bullet spawn (as a step event on the ship obj) is:
var _yy = y + lengthdir_y(20, image_angle);
var _xx = x - lengthdir_x(8, image_angle);
bullet1 = instance_create_layer(_xx, _yy, "Instances", obj_bullet)
bullet1.direction = image_angle;
Can anyone advise?
The example from the GML reference pages made it sound like it would work "This will create a bullet instance at (_xx, _yy), which will be 64 pixels from the parent instance in the direction of the image angle."
Im sure im just missing something stupid, enjoying my time with it though