T2008
Member
I've continually adjusted by attack code but I can't get it right. The problem is that if the player attacks the enemy, he can just keep pressing attack button and the enemy will die without being able to get attacks in. I've done a few tutorials but nothing seems to work. If there are many enemies, it's not noticeable. Any Ideas? Portions of my code are below:
[The Player creates melee object when press x, etc; I didn't include to keep it brief. If needed, I can include. Thanks for any help!]
ENEMY OBJECT
Collision with player melee object:
Collision With Player
Alarm[1]
Alarm[2]
[The Player creates melee object when press x, etc; I didn't include to keep it brief. If needed, I can include. Thanks for any help!]
ENEMY OBJECT
Collision with player melee object:
Code:
if (alarm[1] == -1) {
//Reduce Animal Hp
hp -=global.attack_strength;
//Increase Skill Points
global.skill_points_melee +=1;
//Change Hit To True
hit = true;
//Reset Alarm
alarm[1] = 90;
}
Code:
//Hurt Player
if (alarm[2] == -1) && (hp > 0) && (!global.climb)
&& (!global.jump) && (!global.been_hit) {
//Reduce Hp
global.hp -= att;
//Change Global Been Hit To True
global.been_hit = true;
//Reset Hurt Alarm
alarm [2] = 60;
}
//Stop Enemy
x = xprevious;
y = yprevious;
Code:
hit = false;
Code:
global.been_hit = false;