Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Armour is not working?
#1
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:

# 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
Do you have any idea, why it is not working as it should?
Thanks for your help.

Piethon
Reply


Messages In This Thread
Armour is not working? - by Piethon - Dec-10-2019, 05:53 PM
RE: Armour is not working? - by nilamo - Dec-10-2019, 06:24 PM
RE: Armour is not working? - by michael1789 - Dec-10-2019, 07:09 PM
RE: Armour is not working? - by Piethon - Dec-11-2019, 07:38 PM
RE: Armour is not working? - by michael1789 - Dec-11-2019, 11:40 PM
RE: Armour is not working? - by Piethon - Dec-12-2019, 05:09 PM
RE: Armour is not working? - by nilamo - Dec-12-2019, 05:38 PM
RE: Armour is not working? - by Piethon - Dec-13-2019, 01:36 PM
RE: Armour is not working? - by michael1789 - Dec-13-2019, 03:58 PM
RE: Armour is not working? - by Piethon - Dec-13-2019, 04:03 PM
RE: Armour is not working? - by michael1789 - Dec-13-2019, 05:29 PM
RE: Armour is not working? - by Piethon - Dec-14-2019, 01:32 PM
RE: Armour is not working? - by Windspar - Dec-13-2019, 11:43 PM
RE: Armour is not working? - by Windspar - Dec-14-2019, 02:22 PM
RE: Armour is not working? - by Piethon - Dec-14-2019, 04:04 PM
RE: Armour is not working? - by michael1789 - Dec-14-2019, 04:38 PM
RE: Armour is not working? - by Piethon - Dec-15-2019, 10:10 AM
RE: Armour is not working? - by Windspar - Dec-15-2019, 10:48 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020