Merge branch 'entities_branch' of https://git.wmi.amu.edu.pl/s444409/DSZI_Survival into MapNew
This commit is contained in:
commit
061455605d
@ -1,31 +0,0 @@
|
|||||||
from src.entities.Entity import Entity
|
|
||||||
|
|
||||||
|
|
||||||
class Collidable(Entity):
|
|
||||||
|
|
||||||
def __init__(self, texture, pos, id):
|
|
||||||
super().__init__(texture, pos, id)
|
|
||||||
|
|
||||||
def check_for_collision(self, x_pos, y_pos):
|
|
||||||
if self.pos[0] == x_pos:
|
|
||||||
if self.pos[1] == y_pos:
|
|
||||||
return True
|
|
||||||
|
|
||||||
return False
|
|
||||||
|
|
||||||
|
|
||||||
#col = Collidable(1, 1, 1)
|
|
||||||
|
|
||||||
|
|
||||||
"""
|
|
||||||
def interact_with_hp(self, hp, Statistics):
|
|
||||||
Statistics.set_hp(hp)
|
|
||||||
|
|
||||||
def interact_with_hunger(self, hunger, Statistics):
|
|
||||||
Statistics.set_hunger(hunger)
|
|
||||||
|
|
||||||
def interact_with_thirst(self, thirst, Statistics):
|
|
||||||
Statistics.set_thirst(thirst)
|
|
||||||
|
|
||||||
def interact_with_stamina(self, stamina, Statistics):
|
|
||||||
Statistics.set_stamina(stamina)"""
|
|
@ -1,10 +1,8 @@
|
|||||||
from src.entities.Collidable import Collidable
|
|
||||||
from src.entities.Interactable import Interactable
|
from src.entities.Interactable import Interactable
|
||||||
|
|
||||||
|
|
||||||
class Npc(Collidable, Interactable):
|
class Npc(Interactable):
|
||||||
def __init__(self, texture, pos, id, path, speed):
|
def __init__(self, texture, pos, id, path, speed):
|
||||||
Collidable.__init__(self, texture, pos, id)
|
|
||||||
Interactable.__init__(self, texture, pos, id)
|
Interactable.__init__(self, texture, pos, id)
|
||||||
self.path = path
|
self.path = path
|
||||||
self.speed = speed
|
self.speed = speed
|
||||||
|
@ -1,5 +1,17 @@
|
|||||||
import src.entities.Interactable as Interactable
|
import src.entities.Interactable as Interactable
|
||||||
|
from src.entities import Statistics, Player
|
||||||
|
from game.MapNew import Map
|
||||||
|
|
||||||
class Pickupable(Interactable):
|
class Pickupable(Interactable):
|
||||||
pass
|
def __init__(self, texture, pos, id, Statistics):
|
||||||
|
super().__init__(texture, pos, id)
|
||||||
|
self.is_pickupable = True
|
||||||
|
self.Statistics = Statistics
|
||||||
|
|
||||||
|
def on_pickup(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)
|
||||||
|
|
||||||
|
Map.removeSpriteFromMap(self)
|
||||||
|
Loading…
Reference in New Issue
Block a user