menu stuff

This commit is contained in:
pennyrigate 2024-07-07 18:25:37 -04:00
parent 89df5eaca0
commit 3ad1b32492
6 changed files with 90 additions and 55 deletions

View file

@ -3,3 +3,6 @@ extends Node2D
func _ready() -> void:
Fade.fade_in(Options.transition_speed_secs)
func _input(event):
Game.change_map(load("res://menus/level_select_scholar.tscn"))

View file

@ -136,6 +136,7 @@ texture = ExtResource( 8 )
position = Vector2( 89, 149 )
rotation = 0.785398
frames = SubResource( 24 )
frame = 3
playing = true
script = ExtResource( 5 )
speed = Vector2( 100, 100 )
@ -145,6 +146,7 @@ position = Vector2( 78, 67 )
rotation = 0.785398
scale = Vector2( -1, 1 )
frames = SubResource( 24 )
frame = 3
playing = true
script = ExtResource( 5 )
speed = Vector2( -100, -100 )
@ -153,7 +155,7 @@ speed = Vector2( -100, -100 )
position = Vector2( 181, 130 )
rotation = -0.785398
frames = SubResource( 24 )
frame = 5
frame = 2
playing = true
script = ExtResource( 5 )
speed = Vector2( 100, -100 )
@ -163,7 +165,7 @@ position = Vector2( 175, 22 )
rotation = 0.785398
scale = Vector2( -1, 1 )
frames = SubResource( 24 )
frame = 5
frame = 2
playing = true
script = ExtResource( 5 )
speed = Vector2( -100, -100 )
@ -171,17 +173,18 @@ speed = Vector2( -100, -100 )
[node name="AnimatedSprite" type="AnimatedSprite" parent="."]
position = Vector2( 192, 92 )
frames = SubResource( 35 )
frame = 1
playing = true
[node name="AnimatedSprite2" type="AnimatedSprite" parent="."]
position = Vector2( 37, 107 )
frames = SubResource( 35 )
frame = 1
playing = true
[node name="AnimatedSprite3" type="AnimatedSprite" parent="."]
position = Vector2( 222, 166 )
frames = SubResource( 35 )
frame = 9
playing = true
[node name="DeathSplatter" parent="." instance=ExtResource( 6 )]

View file

@ -8,6 +8,7 @@ var selected_shard: int = 0
var tween: SceneTreeTween = null
var hop_tween: SceneTreeTween = null
var boss_shown: bool = false
var starting_level = false
onready var level_path: Path2D = $LevelPath
onready var player_position: PathFollow2D = $"%PlayerPosition"
@ -30,6 +31,7 @@ onready var boss_block: TextureRect = $"%BossBlock"
onready var shards_block: HBoxContainer = $"%ShardsBlock"
onready var shards_needed: Label = $"%ShardsNeeded"
onready var world_title: Label = $"%WorldTitle"
onready var options_screen = $OptionsScreen
func _ready() -> void:
var palette = load("res://graphics/player/palettes/%s.tex" % Game.current_palette)
@ -89,12 +91,12 @@ func _process(delta: float) -> void:
func _input(event: InputEvent) -> void:
if event.is_action_pressed("ui_cancel") and $"%MenuPopup".rect_scale.y >= 1.0:
animation_player.play("hide_menu")
# if event.is_action_pressed("ui_cancel") and $"%MenuPopup".rect_scale.y >= 1.0:
# animation_player.play("hide_menu")
pass
func _gui_input(event: InputEvent) -> void:
if event.is_action_pressed("ui_cancel"):
if event.is_action_pressed("ui_cancel") or event.is_action_pressed("pause") && $"%MenuPopup".visible == false:
animation_player.play("show_menu")
if not made_selection: # player is walking around
if event.is_action_pressed("ui_accept"):
@ -109,7 +111,8 @@ func _gui_input(event: InputEvent) -> void:
if _can_travel(level):
_select_level(level)
else: # player has selected level
if event.is_action_pressed("ui_accept"):
if event.is_action_pressed("ui_start") or event.is_action_pressed("ui_accept"):
starting_level = true
Game.current_level = selected_level
Game.change_map(LevelData.levels[selected_level].scene)
elif event.is_action_pressed("ui_cancel"):
@ -199,6 +202,16 @@ func _update_stats() -> void:
var save_data: Save.LevelSaveData = Save.current_file.levels[save_id]
if LevelData.levels[selected_level].boss:
boss_time.text = Game.format_time(save_data.time_any)
match selected_level:
3:
$"%PressStartBoss".text = "Press Start To Fight!"
$"%BossFlavorText".text = "Swiftest Slay"
7:
$"%PressStartBoss".text = "Press Start To Fight!"
$"%BossFlavorText".text = "Speediest Smashing"
11:
$"%PressStartBoss".text = "Press Start To Change The Future!"
$"%BossFlavorText".text = "Fastest Future"
animation_player.play("show_boss")
boss_shown = true
else:
@ -227,3 +240,5 @@ func _on_ExitMenu_pressed() -> void:
func _on_PalettesButton_button_down() -> void:
SceneManager.current_scene = load("res://menus/palette_select.tscn").instance()

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=34 format=2]
[gd_scene load_steps=35 format=2]
[ext_resource path="res://menus/level_select_scholar.gd" type="Script" id=1]
[ext_resource path="res://graphics/level_select/world_map.png" type="Texture" id=2]
@ -17,6 +17,7 @@
[ext_resource path="res://graphics/level_select/whirlpool.png" type="Texture" id=15]
[ext_resource path="res://graphics/player/palettes/default.tex" type="Texture" id=16]
[ext_resource path="res://shaders/recolor.tres" type="Shader" id=17]
[ext_resource path="res://objects/hud/options_screen_scholar.tscn" type="PackedScene" id=18]
[sub_resource type="CanvasItemMaterial" id=9]
particles_animation = true
@ -131,30 +132,6 @@ tracks/5/keys = {
"update": 0,
"values": [ Vector2( 1, 1 ) ]
}
tracks/6/type = "value"
tracks/6/path = NodePath("BossCenter:visible")
tracks/6/interp = 1
tracks/6/loop_wrap = true
tracks/6/imported = false
tracks/6/enabled = true
tracks/6/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ false ]
}
tracks/7/type = "value"
tracks/7/path = NodePath("BossCenter:rect_scale")
tracks/7/interp = 1
tracks/7/loop_wrap = true
tracks/7/imported = false
tracks/7/enabled = true
tracks/7/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 1, 1 ) ]
}
[sub_resource type="Animation" id=16]
resource_name = "hide_boss"
@ -688,6 +665,16 @@ theme = ExtResource( 4 )
text = "High SCORE:"
align = 1
[node name="PressStart" type="Label" parent="LevelStats"]
material = ExtResource( 6 )
margin_left = 16.0
margin_top = -13.0
margin_right = 160.0
margin_bottom = -3.0
theme = ExtResource( 4 )
text = "press start to play!"
align = 1
[node name="Any" type="Label" parent="LevelStats"]
material = ExtResource( 6 )
margin_left = 39.0
@ -845,17 +832,27 @@ position = Vector2( 31, 71 )
texture = ExtResource( 14 )
offset = Vector2( 5, 0 )
[node name="BossCenter" type="CenterContainer" parent="."]
[node name="BossCenter" type="Control" parent="."]
visible = false
anchor_right = 1.0
anchor_bottom = 1.0
rect_pivot_offset = Vector2( 128, 96 )
[node name="PressStartBoss" type="Label" parent="BossCenter"]
unique_name_in_owner = true
material = ExtResource( 6 )
margin_top = 56.0
margin_right = 256.0
margin_bottom = 66.0
theme = ExtResource( 4 )
text = "press start to fight!"
align = 1
[node name="BossTimeBox" type="Panel" parent="BossCenter"]
margin_left = 68.0
margin_top = 71.0
margin_right = 188.0
margin_bottom = 121.0
margin_left = 48.0
margin_top = 72.0
margin_right = 200.0
margin_bottom = 122.0
grow_horizontal = 2
grow_vertical = 2
rect_min_size = Vector2( 120, 50 )
@ -871,20 +868,21 @@ margin_right = -8.0
margin_bottom = -8.0
alignment = 1
[node name="Header" type="Label" parent="BossCenter/BossTimeBox/VBoxContainer"]
[node name="BossFlavorText" type="Label" parent="BossCenter/BossTimeBox/VBoxContainer"]
unique_name_in_owner = true
material = ExtResource( 6 )
margin_top = 5.0
margin_right = 104.0
margin_right = 136.0
margin_bottom = 15.0
theme = ExtResource( 4 )
text = "Swiftest Slay:"
text = "speediest smashing"
align = 1
[node name="BossTime" type="Label" parent="BossCenter/BossTimeBox/VBoxContainer"]
unique_name_in_owner = true
material = ExtResource( 6 )
margin_top = 19.0
margin_right = 104.0
margin_right = 136.0
margin_bottom = 29.0
text = "0:00.00"
align = 1
@ -995,16 +993,17 @@ margin_right = 97.0
margin_bottom = 10.0
rect_min_size = Vector2( 8, 8 )
[node name="Totals" type="HBoxContainer" parent="MenuPopup/PanelContainer/VBoxContainer"]
[node name="OptionsButton" type="HBoxContainer" parent="MenuPopup/PanelContainer/VBoxContainer"]
margin_top = 28.0
margin_right = 122.0
margin_bottom = 38.0
custom_constants/separation = 0
alignment = 1
[node name="TotalsButton" type="TextureButton" parent="MenuPopup/PanelContainer/VBoxContainer/Totals"]
margin_left = 32.0
margin_right = 40.0
[node name="OptionsButton" type="TextureButton" parent="MenuPopup/PanelContainer/VBoxContainer/OptionsButton"]
unique_name_in_owner = true
margin_left = 28.0
margin_right = 36.0
margin_bottom = 10.0
rect_min_size = Vector2( 8, 8 )
button_mask = 0
@ -1012,15 +1011,15 @@ texture_focused = ExtResource( 5 )
expand = true
stretch_mode = 3
[node name="Label" type="Label" parent="MenuPopup/PanelContainer/VBoxContainer/Totals"]
margin_left = 40.0
margin_right = 82.0
[node name="Label" type="Label" parent="MenuPopup/PanelContainer/VBoxContainer/OptionsButton"]
margin_left = 36.0
margin_right = 85.0
margin_bottom = 10.0
text = "totals"
text = "OPTIONS"
[node name="Spacer" type="Control" parent="MenuPopup/PanelContainer/VBoxContainer/Totals"]
margin_left = 82.0
margin_right = 90.0
[node name="Spacer" type="Control" parent="MenuPopup/PanelContainer/VBoxContainer/OptionsButton"]
margin_left = 85.0
margin_right = 93.0
margin_bottom = 10.0
rect_min_size = Vector2( 8, 8 )
@ -1095,7 +1094,7 @@ margin_bottom = 10.0
focus_neighbour_top = NodePath(".")
focus_neighbour_bottom = NodePath(".")
size_flags_horizontal = 3
text = "No way!"
text = "NO"
[node name="ExitMenu" type="Button" parent="ExitPopup/PanelContainer/VBoxContainer/HBoxContainer"]
margin_left = 57.0
@ -1104,10 +1103,15 @@ margin_bottom = 10.0
focus_neighbour_top = NodePath(".")
focus_neighbour_bottom = NodePath(".")
size_flags_horizontal = 3
text = "yeppers!"
text = "YES"
[node name="OptionsScreen" parent="." instance=ExtResource( 18 )]
visible = false
[connection signal="button_down" from="MenuPopup/PanelContainer/VBoxContainer/Resume/ResumeButton" to="AnimationPlayer" method="play" binds= [ "hide_menu" ]]
[connection signal="button_down" from="MenuPopup/PanelContainer/VBoxContainer/Palettes/PalettesButton" to="." method="_on_PalettesButton_button_down"]
[connection signal="button_down" from="MenuPopup/PanelContainer/VBoxContainer/OptionsButton/OptionsButton" to="." method="_on_OptionsButton_button_down"]
[connection signal="button_down" from="MenuPopup/PanelContainer/VBoxContainer/Menu/MenuButton" to="AnimationPlayer" method="play" binds= [ "show_exit" ]]
[connection signal="pressed" from="ExitPopup/PanelContainer/VBoxContainer/HBoxContainer/StayHere" to="." method="_on_StayHere_pressed"]
[connection signal="pressed" from="ExitPopup/PanelContainer/VBoxContainer/HBoxContainer/ExitMenu" to="." method="_on_ExitMenu_pressed"]
[connection signal="exit" from="OptionsScreen" to="." method="_on_OptionsScreen_exit"]

View file

@ -9,12 +9,16 @@ onready var lore_container = $LoreContainer
# Called when the node enters the scene tree for the first time.
func _ready():
get_tree().paused = true
$Body/Resume.grab_focus()
if Game.marathon_mode:
$Body/Restart.disabled = true
$Body/Restart.focus_mode = Control.FOCUS_NONE
$"%GreyedRestart".visible = true
$Body.text = "RESUME\nRESTART\nOPTIONS\nQUIT GAME"
else:
$Body.text = "RESUME\nRESTART\nOPTIONS\nEXIT LEVEL"
#Random lore
if lore_entries != null and not lore_entries.empty():
current_lore = randi() % lore_entries.size()

View file

@ -347,6 +347,12 @@ move_down={
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":0,"physical_scancode":16777234,"unicode":0,"echo":false,"script":null)
]
}
ui_start={
"deadzone": 0.5,
"events": [ Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":0,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":11,"pressure":0.0,"pressed":false,"script":null)
]
}
[input_devices]