#help to create a new system of carrying weapons that can be used by both player and enemy

8 messages · Page 1 of 1 (latest)

unborn flower
#

Here the code I already have for the player to hold an weapon

#
using_weapon = function(){
    
    if (weapon){
        
        var _fire = mouse_check_button(mb_left);
        
        weapon.shoot = _fire;
        
        var _x, _y;
        
        var _dir = point_direction(x, y, mouse_x, mouse_y);
        
        if (weapon.weapon_category = 1){
            _x = x + lengthdir_x(sprite_width/16, _dir);
            _y = y + lengthdir_y(sprite_height/16, _dir);
        }
        else{
            _x = x + lengthdir_x(sprite_width/4, _dir);
            _y = y + lengthdir_y(sprite_height/4, _dir);
        }
        
        weapon.x = _x;
        weapon.y = _y;
        weapon.image_angle = _dir;
    }
    
}
#

this don't translate well to my new inventory system

#
weapons_store = [noone, noone];

max_weapon_count = 2;

weapon_pointer = 0;
#

how i can adapt this?

#

there's no weapon anymore

#

So I will need to adapt my code and idk how

#

In fact no