Legacy GM [SOLVED] Icon movement

Hello,

I'm creating a survival game and I have a crafting system, but when I move with the inventory open the crafting image has a delay or something (See images, I cant upload a video so the three images are taken one after the other and the images where taken when I was walking to the left). Here is all the code in the button and button creation code:
Code:
Step:

x = view_xview+139;
y = view_yview+13;


left pressed:

if instance_exists(obj_player) {
    if obj_player.wood >= 12 {
        if obj_inv.slot1 = 0 {
            obj_player.wood -= 12;
            obj_inv.slot1 = 1;
        } else if obj_inv.slot2 = 0 {
            obj_player.wood -= 12;
            obj_inv.slot2 = 1;           
        } else if obj_inv.slot3 = 0 {
            obj_player.wood -= 12;
            obj_inv.slot3 = 1;           
        } else if obj_inv.slot4 = 0 {
            obj_player.wood -= 12;
            obj_inv.slot4 = 1;           
        }
    }


icon creation code:
Step:

if instance_exists(obj_player) {
    if obj_player.inv = true {
        if !instance_exists(obj_waxe_craft) {
            instance_create(view_xview+139,view_yview+13,obj_waxe_craft);   
        }
    } else {
        if instance_exists(obj_waxe_craft) {
            instance_destroy(obj_waxe_craft);   
        }       
    }
}
 

Attachments

Top