diff --git a/cursesman/entities.py b/cursesman/entities.py index 2d71ea9..dc63ed7 100644 --- a/cursesman/entities.py +++ b/cursesman/entities.py @@ -349,7 +349,7 @@ def __init__(self, x, y, col=1): self.lives = 3 self.score = 0 self.owner = self.uuid - + self.detonator = False def central_render(self, stdscr, px, py): #always draw the player at the same location self.sprite.render(stdscr, playerXDraw, playerYDraw, col=self.col) @@ -374,6 +374,7 @@ def get_hashed_attributes(self): 'wallpass': self.wallpass, 'bombpass': self.bombpass, 'flamepass': self.flamepass, + 'detonator': self.detonator } def apply_attributes(self, attributes): @@ -383,7 +384,7 @@ def apply_attributes(self, attributes): self.wallpass = attributes.get('wallpass') self.bombpass = attributes.get('bombpass') self.flamepass = attributes.get('flamepass') - + self.detonator = attributes.get('detonator') if attributes.get('lives') < self.lives: self.die() diff --git a/cursesman/main.py b/cursesman/main.py index 9678260..cbd3662 100644 --- a/cursesman/main.py +++ b/cursesman/main.py @@ -307,7 +307,6 @@ def init_room_from_server(data): player.bomb_power=5 player.flamepass = True player.wallpass = True - render_iter = 0 while not game_over: if debug_mode: @@ -387,6 +386,10 @@ def init_room_from_server(data): elif inp in [ord(' '), ord('e')]: if nplayerbombs < player.max_bombs: room.append(Bomb(player.x, player.y, col=player.col, power=player.bomb_power, owner=local_player_id)) + elif inp in [ord('f'), ord('m')]: + if nplayerbombs > 0 and player.detonator: + bombs = [r for r in room if isinstance(r,Bomb)] + bombs[0].explode() player.tick() diff --git a/cursesman/rooms.py b/cursesman/rooms.py index d07b61e..e0d0bf9 100644 --- a/cursesman/rooms.py +++ b/cursesman/rooms.py @@ -1,9 +1,8 @@ from cursesman.entities import Pass, Balloom, Oneil, Doll, Powerup, Minvo, Kondoria, Pontan rooms = [ - ('2345', 20, 14, [], Powerup('powerup_flames',0,0)), - ('DEBUG', 20, 14, 1*[Minvo(0,0)] + 1*[Kondoria(0,0)] + 1*[Pontan(0,0)], Powerup('powerup_flames',0,0)), - ('2345', 20, 14, 6*[Balloom(0,0)], Powerup('powerup_flames',0,0)), - ('1234', 20, 14, 3*[Oneil(0,0)] + 3*[Balloom(0,0)], Powerup('powerup_bombs', 0, 0)), - ('1234', 20, 14, (2*[Oneil(0,0)] + 2*[Balloom(0,0)] + 2*[Doll(0,0)]), Powerup('powerup_bombs',0,0)) + ('1', 20, 14, 1*[Balloom(0,0)], Powerup('powerup_flames',0,0)), + ('2', 20, 14, 3*[Balloom(0,0)] + 3*[Oneil(0,0)] + 1*[Pontan(0,0)], Powerup('powerup_bombs',0,0)), + ('3', 20, 14, 2*[Balloom(0,0)] + 2*[Oneil(0,0)] + 2*[Doll(0,0)], Powerup('powerup_detonator',0,0)), + ('4', 20, 14, 1*[Balloom(0,0)] + 1*[Oneil(0,0)] + 2*[Doll(0,0)] + 2*[Minvo(0,0)], Powerup('powerup_speed', 0, 0)), + ('5', 20, 14, 4*[Oneil(0,0)] + 3*[Doll(0,0)], Powerup('powerup_bombs',0,0))] -] diff --git a/cursesman/sprites/powerup_detonator/idle.txt b/cursesman/sprites/powerup_detonator/idle.txt new file mode 100644 index 0000000..c2cb4ae --- /dev/null +++ b/cursesman/sprites/powerup_detonator/idle.txt @@ -0,0 +1,4 @@ +X=X +=X=| +X=X| +---+ diff --git a/cursesman/utils.py b/cursesman/utils.py index b3eca70..0264336 100644 --- a/cursesman/utils.py +++ b/cursesman/utils.py @@ -1,10 +1,8 @@ import ctypes from cursesman.settings import MUSIC_DIR - from playsound import playsound import threading - def play_sound(path): k = lambda: playsound(str(MUSIC_DIR / path)) t = threading.Thread(target=k) @@ -19,3 +17,4 @@ def loop_sound(path, length): t = threading.Thread(target=k) t.start() return t +