From 8636d571b597095f176fe634d7e1537f74356556 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Sat, 26 Dec 2020 00:52:47 +0100 Subject: [PATCH] Add ladders in the map --- squirrelbattle/assets/example_map.txt | 4 ++-- squirrelbattle/assets/example_map_2.txt | 4 ++-- squirrelbattle/display/texturepack.py | 2 ++ squirrelbattle/interfaces.py | 7 +++++++ 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/squirrelbattle/assets/example_map.txt b/squirrelbattle/assets/example_map.txt index 5aaade9..e52172c 100644 --- a/squirrelbattle/assets/example_map.txt +++ b/squirrelbattle/assets/example_map.txt @@ -1,8 +1,8 @@ 1 6 ####### ############# - #.....# #...........# + #.H...# #...........# #.....# #####...........# - #.....# #...............# + #.....# #............H..# #.##### #.###...........# #.# #.# #...........# #.# #.# ############# diff --git a/squirrelbattle/assets/example_map_2.txt b/squirrelbattle/assets/example_map_2.txt index 8864f04..c959659 100644 --- a/squirrelbattle/assets/example_map_2.txt +++ b/squirrelbattle/assets/example_map_2.txt @@ -1,6 +1,6 @@ 1 17 ########### ######### - #.........# #.......# + #....H....# #.......# #.........# ############.......# #.........###############..........#.......############## #.........#........................#....................# @@ -13,7 +13,7 @@ ########.##########......# #.........# #.........# #...........##......# #.........# #.........# #...........##......# #.........# #.........# - #...........##......# #.........# ################.###### + #...........##..H...# #.........# ################.###### #...........##......# #.........# #.................############ #...........##......# ########.########.......#.........#..........# #...........##......# #...............#.......#.........#..........# diff --git a/squirrelbattle/display/texturepack.py b/squirrelbattle/display/texturepack.py index 1f6dc76..77bbfc7 100644 --- a/squirrelbattle/display/texturepack.py +++ b/squirrelbattle/display/texturepack.py @@ -64,6 +64,7 @@ TexturePack.ASCII_PACK = TexturePack( EMPTY=' ', EXPLOSION='%', FLOOR='.', + LADDER='H', HAZELNUT='ยค', HEART='โค', HEDGEHOG='*', @@ -90,6 +91,7 @@ TexturePack.SQUIRREL_PACK = TexturePack( EMPTY=' ', EXPLOSION='๐Ÿ’ฅ', FLOOR='โ–ˆโ–ˆ', + LADDER='๐Ÿชœ', HAZELNUT='๐ŸŒฐ', HEART='๐Ÿ’œ', HEDGEHOG='๐Ÿฆ”', diff --git a/squirrelbattle/interfaces.py b/squirrelbattle/interfaces.py index 94025bd..3394af8 100644 --- a/squirrelbattle/interfaces.py +++ b/squirrelbattle/interfaces.py @@ -198,6 +198,7 @@ class Tile(Enum): EMPTY = auto() WALL = auto() FLOOR = auto() + LADDER = auto() @staticmethod def from_ascii_char(ch: str) -> "Tile": @@ -222,6 +223,12 @@ class Tile(Enum): """ return self == Tile.WALL + def is_ladder(self) -> bool: + """ + Is this Tile a ladder? + """ + return self == Tile.LADDER + def can_walk(self) -> bool: """ Check if an entity (player or not) can move in this tile.