T
TGSP
Guest
So in the game I have, my gun shoots it's bullets from the center of the character instead of my gun, what exactly would be the reason for this, I will prove the step event for my gun below:
Code:
//Gravity
if place_free(x,y+1){gravity=0.7 gravity_direction=270}else{gravity=0 gravity_direction=270};
//Gun Grounded
//Gun Pickup
if place_meeting(x,y,obj_potatoman) and keyboard_check_pressed(ord("F"))
{
alarm[0] = 60
};
if alarm[0] = 60
{
obj_ketchup_pistol.x = obj_potatoman.x; obj_ketchup_pistol.y = obj_potatoman.y
};
//Gun Release
if place_meeting(x,y,obj_potatoman) and keyboard_check_pressed(ord("R")) and alarm[0] = 60 and sprite_index = spr_ketchup_pistolR
{
direction = 90; speed = 6; alarm[0] = 0; image_angle = 0;
}
else
if place_meeting(x,y,obj_potatoman) and keyboard_check_pressed(ord("R")) and alarm[0] = 60 and sprite_index = spr_ketchup_pistolL
{
direction = 90; speed = 6; alarm[0] = 0; image_angle = 180;
};
//Gun Image Rotation
if place_meeting(x,y,obj_potatoman) and alarm[60]
{
image_angle = point_direction(obj_potatoman.x, obj_potatoman.y, mouse_x, mouse_y);
};
//Gun Shoot Mechanic
firecounter = firecounter + 1;
if place_meeting(x,y,obj_potatoman) and (mouse_check_button_pressed(mb_left) or mouse_check_button(mb_left)) and firecounter >= firerate and alarm[0] = 60
{
var bullet = instance_create(x, y, obj_ketchup_bullet);
bullet.speed =+15;
bullet.direction = image_angle;
bullet.image_angle = image_angle;
firecounter = 0
};