• Hey! Guest! The 37th GMC Jam will take place between May 28th, 12:00 UTC and June 1st, 12:00 UTC. Why not join in! Click here to find out more!

Legacy GM [SOLVED] Having gun in hand!

S

santeri kalliomaki

Guest
I'm making ragdoll game and guns in ground are visible but if i pick them up they can't be seen... o_O


code in object player step event:

with Hand_R{
if (mouse_check_button_pressed(mb_right)) {
if (gun == -1) {
with (instance_place(x, y, oGunPickup)) {
other.gun = image_index;
instance_destroy();
}
} else {
var oldGun = gun;

// Pickup new gun
if (instance_place(x, y, oGunPickup)) {
with (instance_place(x, y, oGunPickup)) {
other.gun = image_index;
instance_destroy();
}
} else {
// no gun
gun = -1;
}

// Throw old gun
with (instance_create(x, y, oGunPickup)) {
image_index = oldGun;
direction = point_direction(other.x, other.y, mouse_x, mouse_y);
speed = 14;



}
}
}}


code in player create event:
with Hand_R{
gun = 0;}

code in gun object create event:

image_index = choose(0, 1); (it has 2 different sprites)
image_speed = 0;
image_angle = random(360);
 
Top