Skip to content

Commit

Permalink
More small updates to the Hx8 game.
Browse files Browse the repository at this point in the history
Updated dependencies in nix config, fixed misc bugs, and refactored code.
  • Loading branch information
erikvarga committed Oct 8, 2024
1 parent d6567a1 commit 2a93b02
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 14 deletions.
4 changes: 2 additions & 2 deletions 2024/hackceler8/handout/game.nix
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ let
src = fetchFromGitHub {
owner = "implr";
repo = "moderngl-window";
rev = "150b9cbcd16f7d505b2753503753ab033099b6b3";
hash = "sha256-zFuN+PFUc5w+YzHQjqG9neUs0rt87bxix5IB7b/V/4Y=";
rev = "d089e9b1499449f59d0b138e8501cbeae50844bd";
hash = "sha256-d+1Q+D4RKIHxToAi+d8q8G43kSCTRVt0PsKMk+WECCQ=";
};
});
pythonEnv = pkgs.python3.withPackages (p:
Expand Down
4 changes: 3 additions & 1 deletion 2024/hackceler8/handout/game/components/flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ def last_boss(self):
total += 1
return total == beat + 1

def obtain_flag(self, name, coll_time=time.time()):
def obtain_flag(self, name, coll_time=None):
if coll_time is None:
coll_time = time.time()
for f in self.flags:
if f.name == name:
if f.collected_time == 0:
Expand Down
3 changes: 0 additions & 3 deletions 2024/hackceler8/handout/game/components/player.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,6 @@ def update_movement(self, pressed_keys, newly_pressed_keys):
if not self.in_the_air:
self.last_ground_pos = Point(self.x, self.y)

if not self.in_the_air:
self.last_ground_pos = Point(self.x, self.y)

def change_direction(self, direction: str, sprinting):
self.direction = direction

Expand Down
2 changes: 1 addition & 1 deletion 2024/hackceler8/handout/game/components/weapon/weapon.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def fireball(self, speed_x, size=1):
origin="player",
base_damage=Weapon.damage,
scale=size,
weapon=self.name,
weapon=self.display_name,
)

def equip(self, player):
Expand Down
2 changes: 2 additions & 0 deletions 2024/hackceler8/handout/game/venator_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ def tick(self, _delta_time: float):
self._center_camera_to_player()

def on_key_press(self, symbol: int, _modifiers: int):
if self.game is None:
return
k = Keys.from_ui(symbol)
if k:
self.game.raw_pressed_keys.add(k)
Expand Down
4 changes: 2 additions & 2 deletions 2024/hackceler8/server/game.nix
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ let
src = fetchFromGitHub {
owner = "implr";
repo = "moderngl-window";
rev = "150b9cbcd16f7d505b2753503753ab033099b6b3";
hash = "sha256-zFuN+PFUc5w+YzHQjqG9neUs0rt87bxix5IB7b/V/4Y=";
rev = "d089e9b1499449f59d0b138e8501cbeae50844bd";
hash = "sha256-d+1Q+D4RKIHxToAi+d8q8G43kSCTRVt0PsKMk+WECCQ=";
};
});
pythonEnv = pkgs.python3.withPackages (p:
Expand Down
4 changes: 3 additions & 1 deletion 2024/hackceler8/server/game/components/flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ def last_boss(self):
total += 1
return total == beat + 1

def obtain_flag(self, name, coll_time=time.time()):
def obtain_flag(self, name, coll_time=None):
if coll_time is None:
coll_time = time.time()
for f in self.flags:
if f.name == name:
if f.collected_time == 0:
Expand Down
3 changes: 0 additions & 3 deletions 2024/hackceler8/server/game/components/player.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,6 @@ def update_movement(self, pressed_keys, newly_pressed_keys):
if not self.in_the_air:
self.last_ground_pos = Point(self.x, self.y)

if not self.in_the_air:
self.last_ground_pos = Point(self.x, self.y)

def change_direction(self, direction: str, sprinting):
self.direction = direction

Expand Down
2 changes: 1 addition & 1 deletion 2024/hackceler8/server/game/components/weapon/weapon.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def fireball(self, speed_x, size=1):
origin="player",
base_damage=Weapon.damage,
scale=size,
weapon=self.name,
weapon=self.display_name,
)

def equip(self, player):
Expand Down
2 changes: 2 additions & 0 deletions 2024/hackceler8/server/game/venator_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ def tick(self, _delta_time: float):
self._center_camera_to_player()

def on_key_press(self, symbol: int, _modifiers: int):
if self.game is None:
return
k = Keys.from_ui(symbol)
if k:
self.game.raw_pressed_keys.add(k)
Expand Down

0 comments on commit 2a93b02

Please sign in to comment.