C
Cybert99
Guest
Terrible programmer here.
I'm sure I could figure this out on my own, but I have to leave for work in a few minutes. Grrrrrr.
I have a ship and I'm trying to add a few guns to it. I have one object (obj_gun) and I'm creating multiple instances of that object called (gun_1, gun_2, etc.):
CREATE EVENT OF OBJ_SHIP:
var gun_1;
gun_1 = (instance_create_depth(x,y,0,obj_gun))
with gun_1 {
image_angle = other.direction;
initialAngle = 0;
offset_x = -15;
offset_y = 0;
anchor_dir = point_direction(0,0,offset_x,offset_y);
anchor_dist = point_distance(0,0,offset_x,offset_y);
}
STEP EVENT OF OBJ_GUN:
if (instance_exists(gun_1)) {
x = gun_1.x + lengthdir_x(anchor_dist, anchor_dir+other.image_angle);
y = gun_1.y + lengthdir_y(anchor_dist, anchor_dir+other.image_angle);
image_angle = gun_1.image_angle + initialAngle;
}
This is giving me a variable does not exist error. What am I doing wrong?
I'm sure I could figure this out on my own, but I have to leave for work in a few minutes. Grrrrrr.
I have a ship and I'm trying to add a few guns to it. I have one object (obj_gun) and I'm creating multiple instances of that object called (gun_1, gun_2, etc.):
CREATE EVENT OF OBJ_SHIP:
var gun_1;
gun_1 = (instance_create_depth(x,y,0,obj_gun))
with gun_1 {
image_angle = other.direction;
initialAngle = 0;
offset_x = -15;
offset_y = 0;
anchor_dir = point_direction(0,0,offset_x,offset_y);
anchor_dist = point_distance(0,0,offset_x,offset_y);
}
STEP EVENT OF OBJ_GUN:
if (instance_exists(gun_1)) {
x = gun_1.x + lengthdir_x(anchor_dist, anchor_dir+other.image_angle);
y = gun_1.y + lengthdir_y(anchor_dist, anchor_dir+other.image_angle);
image_angle = gun_1.image_angle + initialAngle;
}
This is giving me a variable does not exist error. What am I doing wrong?