Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/3-combat-system' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Anonymous authored and Anonymous committed Apr 2, 2023
2 parents 40db916 + 1788c30 commit 5db8d49
Show file tree
Hide file tree
Showing 11 changed files with 334 additions and 159 deletions.
50 changes: 14 additions & 36 deletions src/pyweek_2023_03/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,7 @@ def on_click_quit(event):
arcade.play_sound(self.click_sound)
arcade.exit()

self.manager.add(
arcade.gui.UIAnchorWidget(
anchor_x="center_x", anchor_y="center_y", child=self.v_box
)
)
self.manager.add(arcade.gui.UIAnchorWidget(anchor_x="center_x", anchor_y="center_y", child=self.v_box))

def on_show_view(self):
"""This is run once when we switch to this view"""
Expand Down Expand Up @@ -109,28 +105,22 @@ def __init__(self):

self.v_box = arcade.gui.UIBoxLayout()

self.fs_button = arcade.gui.UIFlatButton(
text="Make fullscreen", width=200
)
self.fs_button = arcade.gui.UIFlatButton(text="Make fullscreen", width=200)
self.v_box.add(self.fs_button.with_space_around(bottom=20))

# IDK what this is meant to do so this is just placeholder for now
self.audio_button = arcade.gui.UIFlatButton(
text="Audio button", width=200
)
self.audio_button = arcade.gui.UIFlatButton(text="Audio button", width=200)
self.v_box.add(self.audio_button.with_space_around(bottom=20))

actions, *keybinds = KEYMAP_DICT.keys(), *zip_longest(
*KEYMAP_DICT.values(), fillvalue=""
)
actions, *keybinds = KEYMAP_DICT.keys(), *zip_longest(*KEYMAP_DICT.values(), fillvalue="")
key_box = arcade.gui.UIBoxLayout(vertical=False)
# Action box
action_box = arcade.gui.UIBoxLayout(size_hint=0.8)
for action in actions:
action_box.add(
arcade.gui.UILabel(
text=action, font_size=30, text_color=arcade.color.BLACK
).with_space_around(bottom=20)
arcade.gui.UILabel(text=action, font_size=30, text_color=arcade.color.BLACK).with_space_around(
bottom=20
)
)
key_box.add(action_box.with_space_around(left=10, right=10))

Expand All @@ -140,9 +130,9 @@ def __init__(self):
column_box = arcade.gui.UIBoxLayout(size_hint=0.1)
for keybind in column:
column_box.add(
arcade.gui.UIFlatButton(
text=ARCADE_KEYS_TO_NAME.get(keybind, ""), width=200
).with_space_around(bottom=20)
arcade.gui.UIFlatButton(text=ARCADE_KEYS_TO_NAME.get(keybind, ""), width=200).with_space_around(
bottom=20
)
)
key_box.add(column_box.with_space_around(left=10, right=10))

Expand All @@ -152,22 +142,12 @@ def __init__(self):
@self.fs_button.event("on_click")
def on_flip_fullscreen(event):
self.window.set_fullscreen(not self.window.fullscreen)
self.fs_button.text = (
{self.fs_button.text} ^ {"Make fullscreen", "Minimize screen"}
).pop()
self.fs_button.text = ({self.fs_button.text} ^ {"Make fullscreen", "Minimize screen"}).pop()

self.manager.add(
arcade.gui.UIAnchorWidget(
anchor_x="center_x", anchor_y="center_y", child=self.v_box
)
)
self.manager.add(arcade.gui.UIAnchorWidget(anchor_x="center_x", anchor_y="center_y", child=self.v_box))

return_button = arcade.gui.UIFlatButton(text="<-", width=100)
self.manager.add(
arcade.gui.UIAnchorWidget(
anchor_x="left", anchor_y="top", child=return_button
)
)
self.manager.add(arcade.gui.UIAnchorWidget(anchor_x="left", anchor_y="top", child=return_button))

# pylint: disable=unused-argument
@return_button.event("on_click")
Expand All @@ -192,9 +172,7 @@ def on_draw(self):

def main():
"""Main function"""
window = arcade.Window(
SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_TITLE, resizable=True
)
window = arcade.Window(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_TITLE, resizable=True)
start_view = StartView()
window.show_view(start_view)
arcade.run()
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions src/pyweek_2023_03/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,9 @@
}

ANIMATION_FREEZE_TIME = 3

# Attacks
COLLISION_DAMAGE = 10
INVULNERABILITY_DURATION = 1
MELEE_RANGE = 150
SLASH_DURATION = 0.5
Loading

0 comments on commit 5db8d49

Please sign in to comment.