Dec-10-2019, 05:53 PM
Hello everybody,
since a couple of weeks, I am trying to add armour into my game. But it not seems to be working.
The damage that the mob does, should get subtracted my the armour protection number. But this is not happening.
Here's the necessary code:
The whole thing is in the update section:
Do you have any idea, why it is not working as it should?
Thanks for your help.
Piethon
since a couple of weeks, I am trying to add armour into my game. But it not seems to be working.
The damage that the mob does, should get subtracted my the armour protection number. But this is not happening.
Here's the necessary code:
The whole thing is in the update section:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
# zombies hit player hits = pg.sprite.spritecollide( self .player, self .zombies, False , collide_hit_rect) for hit in hits: hit.vel = vec( 0 , 0 ) if self .player.health < = 0 : self .playing = False if hits: self .player.hit() self .player.pos + = vec(ZOMBIE_KNOCKBACK, 0 ).rotate( - hits[ 0 ].rot) if self .player.leather_chest_plate_on = = True : self .leather_chest_plate_protection - = ZOMBIE_DAMAGE if self .leather_chest_plate_protection < 1 : self .player.health - = ZOMBIE_DAMAGE else : self .player.health - = ZOMBIE_DAMAGE |
Thanks for your help.
Piethon