Skip to content

Commit

Permalink
Adapt to simplified ChamberCourt main loop
Browse files Browse the repository at this point in the history
  • Loading branch information
rrthomas committed Jan 17, 2025
1 parent 79ca527 commit bab5bee
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions wincoll/wincoll_game.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,7 @@ def unlock(self) -> None:
def can_move(self, velocity: Vector2) -> bool:
newpos = self.hero.position + velocity
block = self.get(newpos)
if block in (
Tile.EMPTY,
Tile.EARTH,
Tile.DIAMOND,
Tile.KEY,
):
if block in (Tile.EMPTY, Tile.EARTH, Tile.DIAMOND, Tile.KEY):
return True
if block == Tile.ROCK:
new_rockpos = self.hero.position + velocity * 2
Expand Down Expand Up @@ -169,7 +164,7 @@ def reset_falling(self) -> None:
self.falling = False
SLIDE_SOUND.stop()

def do_physics(self) -> None:
def do_play(self) -> None:
# Put Win into the map data for collision detection.
self.set(self.hero.position, Tile.HERO)
new_fall = False
Expand All @@ -178,6 +173,7 @@ def fall(oldpos: Vector2, newpos: Vector2) -> None:
block_below = self.get(newpos + Vector2(0, 1))
if block_below == Tile.HERO:
self.dead = True
self.hero.velocity = Vector2(0, 0)
self.set(oldpos, Tile.EMPTY)
self.set(newpos, Tile.ROCK)
nonlocal new_fall
Expand Down Expand Up @@ -212,6 +208,8 @@ def fall(oldpos: Vector2, newpos: Vector2) -> None:

self.set(self.hero.position, Tile.EMPTY)

self.do_move()

def die(self) -> None:
self.die_sound.play()
self.game_surface.blit(
Expand Down

0 comments on commit bab5bee

Please sign in to comment.