D
DonMaklesso
Guest
Hi guys! I've been making a rogue-like game and stopped on player's melee attacks (I use hitboxes which damages enemies on contact). Everythings fine until I speed up those attacks by percentage amount of player's missing health (the less health, the faster attacks). So I've added the amount of lost hp (multiplied by 100) divided by 200 to default image_speed=1 [image_speed=1+(lost_hp/200);], so that every single percent of missing health boosts attack speed by that 1%. Here's the code:
The problem is that the hitboxes only show up when player's health is equal to his maximum health (lost_hp=0). So my question is why hitboxes doesn't show when attack speed (image_speed) is boosted?
Thanks in advance!
Code:
if mouse_check_button(mb_left) && (spin=false) && (grounded=true) && (hspd=0) { sprite_index=spr_barbarian_attack; if (attack=0) { image_index=1; attack=1; } image_speed=1+(lost_hp/200);//(1+blood_speed/);
if (image_index=5)
{ with(instance_create_layer(x,y,"Hitbox",obj_barbarian_hitbox))
{image_xscale=other.image_xscale; with(instance_place(x,y,parent_enemy)) {hp=hp-(600+floor(blood*2)); }}}
if (image_index=8)
{ with(instance_create_layer(x,y,"Hitbox",obj_barbarian_hitbox))
{image_xscale=other.image_xscale; with(instance_place(x,y,parent_enemy)) {hp=hp-(600+floor(blood*2)); }}}
} else attack=0;
Thanks in advance!