Refactor Interactable.py and Pickupable.py

This commit is contained in:
Marcin Kostrzewski 2020-04-06 10:33:29 +02:00
parent c6ab7cc2f4
commit 6d1dc4ffb7
3 changed files with 8 additions and 8 deletions

View File

@ -3,7 +3,7 @@ from src.entities.Entity import Entity
class Interactable(Entity): class Interactable(Entity):
def __init__(self, texture, size, pos, Statistics): def __init__(self, texture, size, pos, Statistics):
super().__init__(texture, size, pos, Statistics) super().__init__(texture, size, pos)
self.Statistics = Statistics self.Statistics = Statistics
def on_interaction(self, Player): def on_interaction(self, Player):

View File

@ -3,6 +3,6 @@ from src.entities.Interactable import Interactable
class Pickupable(Interactable): class Pickupable(Interactable):
def __init__(self, texture, size, pos, Statistics): def __init__(self, texture, size, pos, Statistics):
super().__init__(texture, size, pos) super().__init__(texture, size, pos, Statistics)
self.is_pickupable = True self.is_pickupable = True

View File

@ -42,7 +42,7 @@ class EventManager:
if keys[pygame.K_SPACE]: if keys[pygame.K_SPACE]:
object = self.game.map.getEntityOnCoord(self.player.getFacingCoord()) object = self.game.map.getEntityOnCoord(self.player.getFacingCoord())
if type(object) is Pickupable: if type(object) is Pickupable:
object.on_pickup(self.player) object.on_interaction(self.player)
self.game.map.removeSpriteFromMap(object) self.game.map.removeSpriteFromMap(object)
if keys[pygame.K_w]: if keys[pygame.K_w]:
self.player.rotate(Rotations.NORTH) self.player.rotate(Rotations.NORTH)