M
Max Doerwaldt
Guest
So I have a system to swap weapons and it works, the problem I have is that I can't seem to change the amount of damage they do. They all deal the same amount.
weapon swap code:
var new_weapon = argument0;
var temp = weapon_sprite;
weapon_sprite = new_weapon.sprite_index;
new_weapon.sprite_index = temp;
if (swap_key) {
var nearest_weapon = instance_nearest(x, y, obj_weapon_item);
if (place_meeting(x, y+4, nearest_weapon)) {
scr_swap_weapons(nearest_weapon);
}
}
if (swap_key) {
var nearest_weapon = instance_nearest(x, y, obj_weapon_sword);
if (place_meeting(x, y+4, nearest_weapon)) {
scr_swap_weapons(nearest_weapon);
}
}
and I attempted to change the damage like this:
if (weapon_sprite == stick) {
attack = 1;
}
if (weapon_sprite == sword) {
attack = 3;
}
weapon swap code:
var new_weapon = argument0;
var temp = weapon_sprite;
weapon_sprite = new_weapon.sprite_index;
new_weapon.sprite_index = temp;
if (swap_key) {
var nearest_weapon = instance_nearest(x, y, obj_weapon_item);
if (place_meeting(x, y+4, nearest_weapon)) {
scr_swap_weapons(nearest_weapon);
}
}
if (swap_key) {
var nearest_weapon = instance_nearest(x, y, obj_weapon_sword);
if (place_meeting(x, y+4, nearest_weapon)) {
scr_swap_weapons(nearest_weapon);
}
}
and I attempted to change the damage like this:
if (weapon_sprite == stick) {
attack = 1;
}
if (weapon_sprite == sword) {
attack = 3;
}