Skip to content

Commit

Permalink
Final polish (#14)
Browse files Browse the repository at this point in the history
## Description

- Update version to beta!!! 🎉🎉🎉
- Add "z", "x", and "esc" as UI navigation controls
- Allow for menus to be used with mouse and keyboard interchangeably
- Update README
- Update CONTRIBUTING
- Update LICENCE (GPLv3)
- Update CODEOWNERS
- Minor discord fix in deploy workflow
- Clean up export configurations
- Add promo card to repo
- Misc. refactoring to remove warnings
  • Loading branch information
Izook authored Apr 24, 2021
1 parent 83e281e commit 5da3306
Show file tree
Hide file tree
Showing 27 changed files with 788 additions and 155 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @Izook
8 changes: 2 additions & 6 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
## Type of Change
## Overview

<!-- (Major, Minor, Patch)? -->
<!-- What was added, fixed, updated? -->

> **⚠️⚠️ DONT FORGET TO UPDATE VERSION FILE ⚠️⚠️**
## Description

<!-- What was added, fixed, updated? -->

## Screenshots

<!-- optional screenshots -->
11 changes: 5 additions & 6 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ on:
env:
BUTLER_API_KEY: ${{ secrets.BUTLER_API_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
IS_MAIN: ${{contains(github.ref, 'main')}}
DISCORD_WEBHOOK: ${{secrets.DISCORD_WEBHOOK}}
PROJECT_NAME: "PsychicBlade"
ITCH_PROJECT_NAME: "psychic-blade"
Expand Down Expand Up @@ -65,7 +64,7 @@ jobs:
path: exports
CreateNewGithubRelease:
needs: BuildAndPublish
if: ${{ contains(github.ref, 'main') }}
if: ${{ github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
steps:
- name: Checkout Source Code
Expand Down Expand Up @@ -105,7 +104,7 @@ jobs:
asset_content_type: application/zip
PushExportsToItch:
needs: BuildAndPublish
if: ${{ contains(github.ref, 'main') }}
if: ${{ github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
steps:
- name: Download Exports
Expand All @@ -128,20 +127,20 @@ jobs:
- name: Push Linux Export To Itch
run: ./butler push ./exports/linux/$PROJECT_NAME.x86_64 $ITCH_USERNAME/$ITCH_PROJECT_NAME:linux --userversion-file ./exports/VERSION
AlertPipelineResult:
if: always()
needs: [BuildAndPublish, CreateNewGithubRelease, PushExportsToItch]
if: ${{ contains(github.ref, 'main') }}
env:
DID_PREV_JOBS_SUCCEED: ${{ contains(needs.BuildAndPublish.result, 'success' ) && contains(needs.CreateNewGithubRelease.result, 'success' ) && contains(needs.PushExportsToItch.result, 'success' ) }}
runs-on: ubuntu-latest
steps:
- name: Send Discord Success Message
if: ${{ env.IS_MAIN && env.DID_PREV_JOBS_SUCCEED == 'true' }}
if: ${{ github.ref == 'refs/heads/main' && env.DID_PREV_JOBS_SUCCEED == 'true' }}
run: |
curl --location --request POST $DISCORD_WEBHOOK \
--header 'Content-Type: application/json' \
--data-raw "{\"content\": \"$PROJECT_NAME has successfully released and deployed!\"}"
- name: Send Discord Failure Message
if: ${{ env.IS_MAIN && env.DID_PREV_JOBS_SUCCEED != 'true' }}
if: ${{ github.ref == 'refs/heads/main' && env.DID_PREV_JOBS_SUCCEED != 'true' }}
run: |
curl --location --request POST $DISCORD_WEBHOOK \
--header 'Content-Type: application/json' \
Expand Down
7 changes: 7 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Contributing

Are you really thinking about contributing to this game? That's awesome!

If you fork my game, make a contribution of any kind, and submit a PR, I can assure I will review the PR and approve it if it's fun!

I look forward to seeing what you decide to do!
674 changes: 674 additions & 0 deletions LICENCE

Large diffs are not rendered by default.

39 changes: 38 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,40 @@
[![Deploy Psychic Blade](https://github.com/Izook/psychic-blade/actions/workflows/deploy.yml/badge.svg)](https://github.com/Izook/psychic-blade/actions/workflows/deploy.yml)[![GitHub release](https://img.shields.io/github/release/izook/psychic-blade.svg)](https://GitHub.com/izook/psychic-blade/releases/)[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://github.com/Izook/psychic-blade/blob/main/LICENCE)[![Made with Godot](https://img.shields.io/badge/made%20using-godot-blue?logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDI0IiBoZWlnaHQ9IjEwMjQiPjxnIHN0cm9rZS13aWR0aD0iLjMiPjxwYXRoIGQ9Ik05MTkgNjczbC0yLTgtMTUxIDE0Yy0xMSAyLTIxIDExLTIyIDIzbC00IDU5LTExNiA5LTgtNTRjLTItMTItMTItMjEtMjUtMjFINDMzYy0xMyAwLTIzIDktMjUgMjFsLTggNTQtMTE2LTktNC01OWMtMS0xMi0xMS0yMS0yMi0yM2wtMTUxLTE0LTIgOC0xIDMzIDEyOCAyMCA0IDYwYzEgMTIgMTEgMjIgMjMgMjNsMTYxIDExaDFjMTIgMCAyMy05IDI1LTIxbDgtNTVoMTE2bDggNTVhMjUgMjUgMCAwMDI2IDIxbDE2MS0xMWMxMi0xIDIyLTExIDIzLTIzbDQtNjAgMTI3LTIweiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xMDUgNDI3djI0NmgxbDE1MSAxNWM4IDEgMTQgNyAxNCAxNWw1IDY2IDEzMSAxMCA5LTYyYzItOCA4LTE0IDE3LTE0aDE1OGM5IDAgMTUgNiAxNyAxNGw5IDYyIDEzMS0xMCA1LTY2YzAtOCA2LTE0IDE0LTE1bDE1MS0xNWgxVjQyN2gxYzIwLTI1IDM4LTUyIDU2LTgxLTI0LTQwLTUyLTc1LTgzLTEwOS0yOSAxNS01NiAzMS04MyA0OC0xMy0xMy0yOC0yMy00Mi0zNC0xNC0xMi0zMC0yMC00Ni0zMCA1LTM0IDctNjcgOC0xMDItMzktMjAtODEtMzMtMTI0LTQyLTE3IDI4LTMyIDU5LTQ2IDg5bC00OC00LTQ4IDRjLTE0LTMwLTI5LTYxLTQ2LTg5LTQzIDktODUgMjItMTI0IDQyIDEgMzUgMyA2OCA4IDEwMi0xNiAxMC0zMiAxOC00NiAzMC0xNCAxMS0yOSAyMS00MiAzNC0yNy0xNy01NC0zMy04My00OC0zMSAzNC01OSA2OS04MyAxMDkgMTggMjkgMzYgNTYgNTYgODF6IiBmaWxsPSIjNDc4Y2JmIi8+PHBhdGggZD0iTTc4NCA3MTlsLTUgNjdjMCA4LTcgMTQtMTUgMTVsLTE2MCAxMWgtMWMtOCAwLTE1LTYtMTYtMTRsLTEwLTYySDQ0N2wtMTAgNjJjLTEgOS04IDE1LTE3IDE0bC0xNjAtMTFjLTgtMS0xNS03LTE1LTE1bC01LTY3LTEzNi0xMyAxIDMzYzAgMTQzIDE4MSAyMTIgNDA3IDIxMyAyMjYtMSA0MDctNzAgNDA3LTIxM2wxLTMzeiIgZmlsbD0iIzQ3OGNiZiIvPjxwYXRoIGQ9Ik0zODkgNTI3YTkxIDkxIDAgMTEtMTgxIDAgOTEgOTEgMCAwMTE4MSAwIiBmaWxsPSIjZmZmIi8+PHBhdGggZD0iTTM2NyA1MzNhNjAgNjAgMCAxMS0xMjAgMCA2MCA2MCAwIDAxMTIwIDAiIGZpbGw9IiM0MTQwNDIiLz48cGF0aCBkPSJNNTEyIDYyNmMtMTYgMC0yOS0xMi0yOS0yNnYtODRjMC0xNSAxMy0yNiAyOS0yNnMyOSAxMSAyOSAyNnY4NGMwIDE0LTEzIDI2LTI5IDI2TTYzNSA1MjdhOTEgOTEgMCAxMDE4MSAwIDkxIDkxIDAgMDAtMTgxIDAiIGZpbGw9IiNmZmYiLz48cGF0aCBkPSJNNjU3IDUzM2E2MCA2MCAwIDEwMTIwIDAgNjAgNjAgMCAwMC0xMjAgMCIgZmlsbD0iIzQxNDA0MiIvPjwvZz48L3N2Zz4=)](https://godotengine.org/)

<p align="center">
<img src="./docs/images/logo.png">
</p>

# Psychic Blade

work in progress...
## Overview

Psychic Blade is a top down dungeon crawler demo where you play a psychic adventurer who rotates a blade around their body to slay enemies and solve puzzles they encounter in their journey.

Currently the game is only a basic demo of the rotational blade mechanic with some simple levels to test the functionality but I may eventually add more enemies and levels to the game.

I highly recommend first time players play the **Tutorial** level and after that try the **Slime Spawners** level to see how long they can last and how high of a combo they can get!

## Play Psychic Blade

You can download and play Psychic Blade for free on either the [itch.io](https://izook.itch.io/psychic-blade) page or from the `exports.zip` file in our Github [releases](https://github.com/Izook/psychic-blade/releases).

## Screenshots

![Slime Spawners](./docs/images/spawners_screenshot.png)
![Puzzles](./docs/images/puzzle_screenshot.png)
![Challenges](./docs/images/challenge_screenshot.png)

## Special Thanks

- [Szadi Art](https://szadiart.itch.io/) for providing the assets for the [map](https://szadiart.itch.io/2d-magic-lands-dung1) and the [player](https://szadiart.itch.io/rpg-main-character)
- [Rvros](https://rvros.itch.io/) for providing the assets for the [slime enemy](https://rvros.itch.io/pixel-art-animated-slime)
- [Snabisch](https://snabisch.itch.io/) for providing [background music](https://snabisch.itch.io/sixty-minutes-free-music) throughout the game
- [SoupTonic](https://twitter.com/soup_tonic) for providing the [UI sound effects](https://souptonic.itch.io/souptonic-sfx-pack-1-ui-sounds)
- [SGB Games](https://sfbgames.com/) for providing [ChipTone](https://sfbgames.itch.io/chiptone) which was used to create a lot of the sound effects
- [TheWiseHedgehog](https://twitter.com/thewisehedgehog) for providing the assets for the [blade](https://thewisehedgehog.itch.io/hs2020)
- [Hyohnoo](https://twitter.com/Hyohnoo) for providing the [keyboard animations](https://hyohnoo.itch.io/keyboard-controller-keys) in the tutorial
- [Google Fonts](https://fonts.google.com/) for providing the [Pirata One](https://fonts.google.com/specimen/Pirata+One#glyphs) font

## Built Using

![Godot Game Engine](https://raw.githubusercontent.com/godotengine/godot/master/logo.png)
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.0.16.alpha
0.1.0.beta
Binary file added docs/images/challenge_screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/promo_card.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/puzzle_screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/spawners_screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 9 additions & 9 deletions export_presets.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path=""
export_path="exports/psychic-blade.exe"
patch_list=PoolStringArray( )
script_export_mode=1
script_encryption_key=""
Expand All @@ -32,14 +32,14 @@ codesign/timestamp_server_url=""
codesign/digest_algorithm=1
codesign/description=""
codesign/custom_options=PoolStringArray( )
application/icon=""
application/icon="res://shared_assets/logo.ico"
application/file_version=""
application/product_version=""
application/company_name=""
application/product_name=""
application/file_description=""
application/company_name="Izook"
application/product_name="Psychic Blade"
application/file_description="Psychic Blade"
application/copyright=""
application/trademarks=""
application/trademarks="Izook"

[preset.1]

Expand Down Expand Up @@ -85,10 +85,10 @@ script_encryption_key=""

custom_template/debug=""
custom_template/release=""
application/name=""
application/name="Psychic Blade"
application/info="Made with Godot Engine"
application/icon=""
application/identifier=""
application/icon="res://shared_assets/logo.icns"
application/identifier="izook.itch.io/psychic-blade"
application/signature=""
application/short_version="1.0"
application/version="1.0"
Expand Down
24 changes: 17 additions & 7 deletions project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,15 @@ _global_script_class_icons={

[application]

config/name="psychic-blade"
config/name="Psychic Blade"
config/description="Psychic Blade is a top down dungeon crawler demo where you play a psychic adventurer who rotates a blade around their body to slay enemies and solve puzzles they encounter in their journey."
run/main_scene="res://scenes/menus/start_menu/start_menu.tscn"
boot_splash/image="res://shared_assets/boot_splash.png"
boot_splash/fullsize=false
boot_splash/bg_color=Color( 0, 0, 0, 1 )
config/icon="res://shared_assets/icon.png"
config/icon="res://shared_assets/logo.png"
config/macos_native_icon="res://shared_assets/logo.icns"
config/windows_native_icon="res://shared_assets/logo.ico"

[autoload]

Expand Down Expand Up @@ -250,12 +255,21 @@ ui_accept={
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777222,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":32,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":1,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":88,"unicode":0,"echo":false,"script":null)
]
}
ui_select={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":32,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":3,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":88,"unicode":0,"echo":false,"script":null)
]
}
ui_cancel={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777217,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":0,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":90,"unicode":0,"echo":false,"script":null)
]
}
move_right={
Expand Down Expand Up @@ -334,6 +348,7 @@ toggle_pause={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":80,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":11,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777217,"unicode":0,"echo":false,"script":null)
]
}

Expand All @@ -342,11 +357,6 @@ toggle_pause={
2d_physics/layer_1="Entities"
2d_physics/layer_2="Blade"

[logging]

file_logging/enable_file_logging=true
file_logging/log_path="res://logs/log.txt"

[rendering]

environment/default_environment="res://default_env.tres"
2 changes: 1 addition & 1 deletion scenes/enemies/spawner/spawner.gd
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func _on_SpawnTimer_timeout() -> void:
if not max_global_enemies_reached:
var new_enemy := enemy_scene.instance() as Node2D
new_enemy.position = position
new_enemy.connect("died", self, "_on_SpawnedEnemy_died")
var _error := new_enemy.connect("died", self, "_on_SpawnedEnemy_died")
get_parent().add_child(new_enemy)
enemies_spawned += 1

Expand Down
6 changes: 3 additions & 3 deletions scenes/level_scenes/levels/tutorial/tutorial.gd
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ func _ready() -> void:
for brazier in blade_spinning_braziers:
brazier.connect("put_out", self, "_on_BladeSpinningBrazier_put_out")

radius_changing_brazier.connect("put_out", self, "_on_RadiusChangingBrazier_put_out")
blade_throwing_brazier.connect("put_out", self, "_on_BladeThrowingBrazier_put_out")
challenge_room_exit_gate.connect("entered", self, "_on_ChallengeRoomExitGate_entered")
var _error := radius_changing_brazier.connect("put_out", self, "_on_RadiusChangingBrazier_put_out")
_error = blade_throwing_brazier.connect("put_out", self, "_on_BladeThrowingBrazier_put_out")
_error = challenge_room_exit_gate.connect("entered", self, "_on_ChallengeRoomExitGate_entered")

radius_changing_cover.visible = true
blade_throwing_cover.visible = true
Expand Down
9 changes: 4 additions & 5 deletions scenes/menus/gameover_menu/gameover_menu.gd
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,19 @@ onready var highest_combo_label := $PanelContainer/MarginContainer/VBoxContainer
onready var select_sound_player := $Audio/SelectSoundPlayer as AudioStreamPlayer
onready var confirm_sound_player := $Audio/ConfirmSoundPlayer as AudioStreamPlayer

var grabbed_focus := true
var active := false


func _input(event: InputEvent) -> void:
if event.is_action_pressed("ui_up") or event.is_action_pressed("ui_down") or event.is_action_pressed("ui_left") or event.is_action_pressed("ui_right"):
if not grabbed_focus:
if active and not get_focus_owner():
main_menu_button.grab_focus()
grabbed_focus = true


func set_active(active: bool) -> void:
func set_active(new_active: bool) -> void:
active = new_active
AudioUtilities.set_distort_music(active)
visible = active
grabbed_focus = false

var hud_node := get_node(Utils.HUD_PATH) as Hud
run_time_label.set_text("Survived For: " + str(hud_node.get_elapsed_time_string()))
Expand Down
9 changes: 4 additions & 5 deletions scenes/menus/level_complete_menu/level_complete_menu.gd
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,19 @@ onready var select_sound_player := $Audio/SelectSoundPlayer as AudioStreamPlayer
onready var confirm_sound_player := $Audio/ConfirmSoundPlayer as AudioStreamPlayer
onready var level_complete_sound_player := $Audio/LevelCompleteSoundPlayer as AudioStreamPlayer

var grabbed_focus := true
var active := false


func _input(event: InputEvent) -> void:
if event.is_action_pressed("ui_up") or event.is_action_pressed("ui_down") or event.is_action_pressed("ui_left") or event.is_action_pressed("ui_right"):
if not grabbed_focus:
if active and not get_focus_owner():
main_menu_button.grab_focus()
grabbed_focus = true


func set_active(active: bool) -> void:
func set_active(new_active: bool) -> void:
active = new_active
AudioUtilities.set_music_mute(active)
visible = active
grabbed_focus = false

var hud_node := get_node(Utils.HUD_PATH) as Hud
run_time_label.set_text("Completion Time: " + str(hud_node.get_elapsed_time_string()))
Expand Down
10 changes: 4 additions & 6 deletions scenes/menus/pause_menu/pause_menu.gd
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,23 @@ onready var resume_sound_player := $Audio/ResumeSoundPlayer as AudioStreamPlayer
onready var select_sound_player := $Audio/SelectSoundPlayer as AudioStreamPlayer
onready var confirm_sound_player := $Audio/ConfirmSoundPlayer as AudioStreamPlayer

var grabbed_focus := true

var active := false

func _ready() -> void:
var _menu_conn_error = connect("unpaused", get_node(Utils.MAIN_PATH), "_on_PauseMenu_unpaused")


func _input(event: InputEvent) -> void:
if event.is_action_pressed("ui_up") or event.is_action_pressed("ui_down") or event.is_action_pressed("ui_left") or event.is_action_pressed("ui_right"):
if not grabbed_focus:
if active and not get_focus_owner():
main_menu_button.grab_focus()
grabbed_focus = true


func set_active(active: bool) -> void:
func set_active(new_active: bool) -> void:
active = new_active
AudioUtilities.set_distort_music(active)
visible = active
if active:
grabbed_focus = false
pause_sound_player.play()
else:
resume_sound_player.play()
Expand Down
26 changes: 16 additions & 10 deletions scenes/menus/start_menu/start_menu.gd
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ onready var version_label := $Version as Label

onready var start_button := $TitleContainer/VBoxContainer/VBoxContainer/StartButton as Button
onready var first_level_button := $LevelsContainer/Panel/MarginContainer/VBoxContainer/CenterContainer2/VBoxContainer.get_children()[0] as Button
onready var ok_controls_button := $ControlsContainer/Panel/MarginContainer/VBoxContainer/CenterContainer/VBoxContainer/OKButton as Button
onready var exit_controls_button := $ControlsContainer/Panel/MarginContainer/ExitControlsButton as TextureButton

onready var title_container := $TitleContainer as MarginContainer
Expand All @@ -27,9 +28,8 @@ onready var quit_sound_player := $Audio/QuitSoundPlayer as AudioStreamPlayer

onready var main := preload("res://scenes/main/main.tscn").instance() as Main

var menu_open := false

var grabbed_focus = false
var start_menu_open := false
var controls_menu_open := false


func _ready() -> void:
Expand All @@ -42,17 +42,23 @@ func _ready() -> void:
func _input(event: InputEvent) -> void:

if event.is_action_pressed("ui_up") or event.is_action_pressed("ui_down") or event.is_action_pressed("ui_left") or event.is_action_pressed("ui_right"):
if not grabbed_focus:
start_button.grab_focus()
grabbed_focus = true
if not get_focus_owner():

if start_menu_open:
first_level_button.grab_focus()
elif controls_menu_open:
ok_controls_button.grab_focus()
else:
start_button.grab_focus()

if event.is_action_pressed('ui_cancel'):
if menu_open:
if start_menu_open or controls_menu_open:
_exit_menu()


func _exit_menu() -> void:
menu_open = false
start_menu_open = false
controls_menu_open = false
title_container.visible = true
levels_container.visible = false
controls_container.visible = false
Expand Down Expand Up @@ -91,15 +97,15 @@ func _on_LevelButton_pressed(level: String) -> void:


func _on_ControlsButton_pressed() -> void:
menu_open = true
controls_menu_open = true
title_container.visible = false
controls_container.visible = true
exit_controls_button.grab_focus()
confirm_sound_player.play()


func _on_StartButton_pressed() -> void:
menu_open = true
start_menu_open = true
title_container.visible = false
levels_container.visible = true
first_level_button.grab_focus()
Expand Down
Loading

0 comments on commit 5da3306

Please sign in to comment.