DEFINE Globals:( HP as Numner PlayerDefense as Number = 15 EnemyAttack as Number = 10 )
On Colision with a Sprite DO:( - IF PlayerDefense = EnemyAttack THEN -- HP = HP - 1 - ELSE IF PlayerDefense > EnemyAttack THEN -- Output("Player sustained no damage from the attack!") - ELSE -- HP = HP - (PlayerDefense - EnemyAttack) )
@delgado I think it would be easier if you didn't use Clamp and instead used "HP - (SmallMonster2.attack - DEFENSEPlayer)"
You should also set a condition for when the Player's Defense is larger than the Monster's attack, otherwise the player will be healed every time it gets hit with an attack that is weaker than the Player Defense. Look at my psuedo code above^^^