diff --git a/game/common/map_object.py b/game/common/map_object.py index 6ac52587..d8682e9f 100644 --- a/game/common/map_object.py +++ b/game/common/map_object.py @@ -1,6 +1,7 @@ from game.common.game_object import GameObject from game.common.enums import * + class MapObject(GameObject): def __init__(self, health=None, coordinates=None, hitbox=None, collidable=None): super().__init__() diff --git a/game/common/stats.py b/game/common/stats.py index 3b40d68d..f43f9e0e 100644 --- a/game/common/stats.py +++ b/game/common/stats.py @@ -3,6 +3,8 @@ class GameStats: game_board_width = 500 game_board_height = 500 + + default_wall_health = 50 player_stats = { 'starting_health': 10, diff --git a/game/common/walls.py b/game/common/walls.py new file mode 100644 index 00000000..3a3ac7a0 --- /dev/null +++ b/game/common/walls.py @@ -0,0 +1,17 @@ +from game.common.map_object import MapObject +from game.common.stats import GameStats + + +class Walls(MapObject): + def __init__(self, coordinates, hitbox, health = GameStats.default_wall_health, destructible = False): + super().__init__(health, coordinates, hitbox, collidable = True ) + self.destructible = destructible + + def to_json(self): + data = super().to_json() + data['destructible'] = self.destructible + return data + + def from_json(self, data): + super().from_json(data) + self.destructible = data['destructible'] \ No newline at end of file