From 6d1dc4ffb76b7dcd43480b7a58539d70922cd2d9 Mon Sep 17 00:00:00 2001 From: Marcin Kostrzewski Date: Mon, 6 Apr 2020 10:33:29 +0200 Subject: [PATCH] Refactor Interactable.py and Pickupable.py --- src/entities/Interactable.py | 12 ++++++------ src/entities/Pickupable.py | 2 +- src/game/EventManager.py | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/entities/Interactable.py b/src/entities/Interactable.py index d3e399b..ed12634 100644 --- a/src/entities/Interactable.py +++ b/src/entities/Interactable.py @@ -3,12 +3,12 @@ from src.entities.Entity import Entity class Interactable(Entity): def __init__(self, texture, size, pos, Statistics): - super().__init__(texture, size, pos, Statistics) + super().__init__(texture, size, pos) self.Statistics = Statistics - def on_interaction(self, Player): - Player.statistics.set_hp(self.Statistics.hp) - Player.statistics.set_stamina(self.Statistics.stamina) - Player.statistics.set_thirst(self.Statistics.thirst) - Player.statistics.set_hunger(self.Statistics.hunger) + def on_interaction(self, Player): + Player.statistics.set_hp(self.Statistics.hp) + Player.statistics.set_stamina(self.Statistics.stamina) + Player.statistics.set_thirst(self.Statistics.thirst) + Player.statistics.set_hunger(self.Statistics.hunger) diff --git a/src/entities/Pickupable.py b/src/entities/Pickupable.py index a0a62c5..bf4cc5e 100644 --- a/src/entities/Pickupable.py +++ b/src/entities/Pickupable.py @@ -3,6 +3,6 @@ from src.entities.Interactable import Interactable class Pickupable(Interactable): def __init__(self, texture, size, pos, Statistics): - super().__init__(texture, size, pos) + super().__init__(texture, size, pos, Statistics) self.is_pickupable = True diff --git a/src/game/EventManager.py b/src/game/EventManager.py index fffb38a..1bc3e42 100644 --- a/src/game/EventManager.py +++ b/src/game/EventManager.py @@ -42,7 +42,7 @@ class EventManager: if keys[pygame.K_SPACE]: object = self.game.map.getEntityOnCoord(self.player.getFacingCoord()) if type(object) is Pickupable: - object.on_pickup(self.player) + object.on_interaction(self.player) self.game.map.removeSpriteFromMap(object) if keys[pygame.K_w]: self.player.rotate(Rotations.NORTH)