the start of marathon mode

This commit is contained in:
Haze Weathers 2024-03-05 18:20:32 -05:00
parent 83f0bccd9a
commit d06acf2522
18 changed files with 607 additions and 26 deletions

View file

@ -1,8 +1,10 @@
class_name MainMenu
extends Node
onready var continue_button = $Panel/Continue
func _ready():
Game.marathon_mode = false
Fade.fade_in(Options.transition_speed_secs)
#Grey out continue if no save files
yield(get_tree(),"idle_frame")
@ -12,28 +14,34 @@ func _ready():
$Panel/Body/GreyedContinue.visible = true
continue_button.visible = false
$Panel/FileSelect.grab_focus()
if Game.last_mm_button != null:
get_node(Game.last_mm_button).grab_focus()
Vector2( 0.83205, 0.5547 )
func _on_Continue_button_down():
Game.last_mm_button = "Panel/Continue"
Fade.fade_out(Options.transition_speed_secs)
yield(Fade, "fade_finished")
SceneManager.current_scene = load("res://menus/level_select_scholar.tscn").instance()
func _on_FileSelect_button_down():
Game.last_mm_button = @"Panel/FileSelect"
Fade.fade_out(Options.transition_speed_secs)
yield(Fade, "fade_finished")
SceneManager.current_scene = load("res://menus/file_select.tscn").instance()
func _on_Exit_button_down():
Game.last_mm_button = @"Panel/FileSelect"
Fade.fade_out(Options.transition_speed_secs)
yield(Fade, "fade_finished")
get_tree().quit()
func _on_SoundTest_button_down():
Game.last_mm_button = @"Panel/SoundTest"
Fade.fade_out(Options.transition_speed_secs)
yield(Fade, "fade_finished")
SceneManager.current_scene = load("res://menus/sound_test.tscn").instance()
@ -41,12 +49,21 @@ func _on_SoundTest_button_down():
func _on_HighScores_button_down() -> void:
Game.last_mm_button = @"Panel/HighScores"
Fade.fade_out(Options.transition_speed_secs)
yield(Fade, "fade_finished")
SceneManager.current_scene = load("res://menus/scoreboards.tscn").instance()
func _on_Options_button_down() -> void:
Game.last_mm_button = @"Panel/Options"
Fade.fade_out(Options.transition_speed_secs)
yield(Fade, "fade_finished")
SceneManager.current_scene = load("res://menus/options_menu.tscn").instance()
func _on_MarathonMode_button_down() -> void:
Game.last_mm_button = @"Panel/MarathonMode"
Fade.fade_out(Options.transition_speed_secs)
yield(Fade, "fade_finished")
SceneManager.current_scene = load("res://menus/marathon_start.tscn").instance()

View file

@ -247,6 +247,8 @@ align = 1
[connection signal="button_down" from="Panel/FileSelect" to="." method="_on_FileSelect_button_down"]
[connection signal="button_down" from="Panel/FileSelect" to="MenuSounds" method="play_confirm_sound"]
[connection signal="focus_entered" from="Panel/FileSelect" to="MenuSounds" method="play_select_sound"]
[connection signal="button_down" from="Panel/MarathonMode" to="." method="_on_MarathonMode_button_down"]
[connection signal="button_down" from="Panel/MarathonMode" to="MenuSounds" method="play_confirm_sound"]
[connection signal="focus_entered" from="Panel/MarathonMode" to="MenuSounds" method="play_select_sound"]
[connection signal="focus_entered" from="Panel/Augmentations" to="MenuSounds" method="play_select_sound"]
[connection signal="button_down" from="Panel/Options" to="." method="_on_Options_button_down"]

19
menus/marathon_results.gd Normal file
View file

@ -0,0 +1,19 @@
extends Control
onready var score: Label = $"%Score"
onready var shards: Label = $"%Shards"
func _ready() -> void:
Audio.play_music(load("res://audio/music/rumble_revolution_demo.ogg"))
score.text = score.text % Game.marathon_score
shards.text = shards.text % Game.marathon_shards
Fade.fade_in()
func _input(event: InputEvent) -> void:
if Input.is_action_just_pressed("ui_accept"):
Fade.fade_out(Options.transition_speed_secs)
yield(Fade, "fade_finished")
Game.change_map(load("res://menus/marathon_start.tscn"))

View file

@ -0,0 +1,77 @@
[gd_scene load_steps=6 format=2]
[ext_resource path="res://shaders/ska_plane.gdshader" type="Shader" id=1]
[ext_resource path="res://ui/theme.tres" type="Theme" id=2]
[ext_resource path="res://menus/marathon_results.gd" type="Script" id=3]
[ext_resource path="res://ui/2ndpuberty_outline.tres" type="Material" id=4]
[sub_resource type="ShaderMaterial" id=1]
shader = ExtResource( 1 )
shader_param/color_1 = Color( 1, 0.709804, 0.380392, 1 )
shader_param/color_2 = Color( 0.345098, 0.945098, 0.905882, 1 )
shader_param/checker_size = Vector2( 24, 24 )
shader_param/pan_speed = Vector2( 8, 12 )
shader_param/cycle_speed = Vector2( 4, 4 )
shader_param/cycle_alternation = Vector2( 4, 4 )
shader_param/uv_transform = Transform2D( 1, 0, 1, 1, 0, 0 )
[node name="MarathonResults" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
theme = ExtResource( 2 )
script = ExtResource( 3 )
[node name="Background" type="ColorRect" parent="."]
material = SubResource( 1 )
anchor_right = 1.0
anchor_bottom = 1.0
[node name="Panel" type="Panel" parent="."]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -60.0
margin_top = -32.0
margin_right = 60.0
margin_bottom = 38.0
[node name="Label" type="Label" parent="Panel"]
material = ExtResource( 4 )
anchor_right = 1.0
margin_bottom = 22.0
text = "Good Job!"
align = 1
valign = 1
[node name="Score" type="Label" parent="Panel"]
unique_name_in_owner = true
material = ExtResource( 4 )
anchor_right = 1.0
margin_left = 4.0
margin_top = 24.0
margin_right = -4.0
margin_bottom = 46.0
text = "Score: %05d"
align = 1
valign = 1
[node name="Shards" type="Label" parent="Panel"]
unique_name_in_owner = true
material = ExtResource( 4 )
anchor_right = 1.0
margin_left = 4.0
margin_top = 46.0
margin_right = -4.0
margin_bottom = 68.0
text = "got %d shards!"
align = 1
valign = 1
[node name="ComingSoon" type="Label" parent="."]
material = ExtResource( 4 )
margin_top = 16.0
margin_right = 256.0
margin_bottom = 39.0
text = "Wow you done did it!"
align = 1

View file

@ -0,0 +1,89 @@
extends Button
const INFINITY_SIGIL := "▬↨"
var delay := 1.0
var cooldown := 0.0
onready var back_arrow: TextureRect = $"../BackArrow"
onready var next_arrow: TextureRect = $"../NextArrow"
func _ready() -> void:
_update_display()
func _process(delta: float) -> void:
if not has_focus():
return
if Input.is_action_pressed("ui_left"):
if cooldown <= 0.0:
cooldown = delay
delay *= 0.5
if Game.use_lives:
Game.marathon_lives -= 1
if Game.marathon_lives < 0:
Game.use_lives = false
cooldown = INF
else:
Game.use_lives = true
Game.marathon_lives = 999
cooldown -= delta
_update_display()
elif Input.is_action_pressed("ui_right"):
if cooldown <= 0.0:
cooldown = delay
delay *= 0.5
if Game.use_lives:
Game.marathon_lives += 1
if Game.marathon_lives > 999:
Game.use_lives = false
cooldown = INF
else:
Game.use_lives = true
Game.marathon_lives = 0
cooldown -= delta
_update_display()
else:
cooldown = 0.0
delay = 1.0
func _update_display() -> void:
if Game.use_lives:
text = "%03d" % Game.marathon_lives
else:
text = INFINITY_SIGIL
#func _gui_input(event: InputEvent) -> void:
# if event.is_action_pressed("ui_left"):
# if Game.use_lives:
# Game.marathon_lives -= 1
# if Game.marathon_lives < 0:
# Game.use_lives = false
# else:
# Game.use_lives = true
# Game.marathon_lives = 999
# if event.is_action_pressed("ui_right"):
# if Game.use_lives:
# Game.marathon_lives += 1
# if Game.marathon_lives > 999:
# Game.use_lives = false
# else:
# Game.use_lives = true
# Game.marathon_lives = 0
# _update_display()
func _on_focus_entered() -> void:
back_arrow.visible = true
next_arrow.visible = true
func _on_focus_exited() -> void:
back_arrow.visible = false
next_arrow.visible = false

49
menus/marathon_start.gd Normal file
View file

@ -0,0 +1,49 @@
extends Control
const DISABLED_COLOR := Color(0xb0b0b0ff)
onready var difficulty_buttons := [
$"%BeginnerButton",
$"%AdvancedButton",
$"%AdvancedButton",
$"%ProfessionalButton",
]
func _ready() -> void:
Fade.fade_in(0.4)
Audio.play_music(load("res://audio/music/rumble_revolution_demo.ogg"))
yield(get_tree(), "idle_frame")
difficulty_buttons[Game.difficulty].grab_focus()
func _input(event: InputEvent) -> void:
if Input.is_action_just_pressed("ui_accept") or Input.is_action_just_pressed("pause"):
Game.marathon_mode = true
Game.lives = Game.marathon_lives
Game.marathon_score = 0
Game.marathon_shards = 0
Game.marathon_deaths = 0
Game.current_level = LevelData.marathon_start
Game.change_map(LevelData.levels[Game.current_level].scene)
elif Input.is_action_just_pressed("ui_cancel"):
Game.marathon_mode = false
Game.current_level = 0
Fade.fade_out(Options.transition_speed_secs)
yield(Fade, "fade_finished")
SceneManager.change_scene(load("res://menus/main_menu.tscn").instance())
func _set_difficulty(difficulty: int) -> void:
var use_lives := Game.use_lives
Game.difficulty = difficulty
Game.use_lives = use_lives
for b in difficulty_buttons:
b.get_parent().modulate = DISABLED_COLOR
difficulty_buttons[difficulty].get_parent().modulate = Color.white
func _on_DifficultySelect_focus_entered() -> void:
difficulty_buttons[Game.difficulty].grab_focus()

250
menus/marathon_start.tscn Normal file
View file

@ -0,0 +1,250 @@
[gd_scene load_steps=13 format=2]
[ext_resource path="res://shaders/ska_plane.gdshader" type="Shader" id=1]
[ext_resource path="res://ui/theme.tres" type="Theme" id=2]
[ext_resource path="res://menus/marathon_start.gd" type="Script" id=3]
[ext_resource path="res://ui/2ndpuberty_outline.tres" type="Material" id=5]
[ext_resource path="res://graphics/hud/file_select_arrow.png" type="Texture" id=6]
[ext_resource path="res://ui/2ndpuberty_scholar_outline.fnt" type="BitmapFont" id=7]
[ext_resource path="res://shaders/wibble_wobble.gdshader" type="Shader" id=8]
[ext_resource path="res://graphics/hud/pause_arrow.png" type="Texture" id=9]
[ext_resource path="res://menus/marathon_select_lives.gd" type="Script" id=10]
[sub_resource type="ShaderMaterial" id=1]
shader = ExtResource( 1 )
shader_param/color_1 = Color( 0.815686, 0.917647, 0.462745, 1 )
shader_param/color_2 = Color( 0.152941, 0.772549, 0.356863, 1 )
shader_param/checker_size = Vector2( 24, 24 )
shader_param/pan_speed = Vector2( 8, 12 )
shader_param/cycle_speed = Vector2( 4, 4 )
shader_param/cycle_alternation = Vector2( 4, 4 )
shader_param/uv_transform = Transform2D( 1, 0, 1, 1, 0, 0 )
[sub_resource type="ShaderMaterial" id=2]
shader = ExtResource( 8 )
shader_param/speed = Vector2( 4, 0 )
shader_param/ammount = Vector2( 2, 0 )
shader_param/offset = Vector2( 0, 0 )
shader_param/delay = Vector2( 0, 0 )
[sub_resource type="ShaderMaterial" id=3]
shader = ExtResource( 8 )
shader_param/speed = Vector2( 4, 0 )
shader_param/ammount = Vector2( 2, 0 )
shader_param/offset = Vector2( 0, 0 )
shader_param/delay = Vector2( 4, 0 )
[node name="MarathonStart" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
theme = ExtResource( 2 )
script = ExtResource( 3 )
[node name="Background" type="ColorRect" parent="."]
material = SubResource( 1 )
anchor_right = 1.0
anchor_bottom = 1.0
[node name="PressStart" type="Label" parent="."]
material = ExtResource( 5 )
anchor_right = 1.0
margin_top = 160.0
margin_bottom = 182.0
theme = ExtResource( 2 )
text = "Press start to begin"
align = 1
valign = 1
[node name="FlavorText" type="Label" parent="."]
material = ExtResource( 5 )
anchor_right = 1.0
margin_top = 8.0
margin_bottom = 31.0
theme = ExtResource( 2 )
text = "Begin your adventure...
in revolution 2083 world"
align = 1
valign = 1
[node name="DifficultySelect" type="PanelContainer" parent="."]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -112.0
margin_top = -48.0
margin_right = 112.0
focus_mode = 2
[node name="VBoxContainer" type="VBoxContainer" parent="DifficultySelect"]
margin_left = 3.0
margin_top = 3.0
margin_right = 221.0
margin_bottom = 45.0
[node name="DiffcultySelect" type="Label" parent="DifficultySelect/VBoxContainer"]
material = ExtResource( 5 )
margin_right = 218.0
margin_bottom = 14.0
rect_min_size = Vector2( 0, 14 )
text = "difficulty select:"
align = 1
valign = 1
[node name="HBoxContainer" type="HBoxContainer" parent="DifficultySelect/VBoxContainer"]
margin_top = 18.0
margin_right = 218.0
margin_bottom = 42.0
custom_constants/separation = 8
alignment = 1
[node name="Beginner" type="VBoxContainer" parent="DifficultySelect/VBoxContainer/HBoxContainer"]
margin_left = 41.0
margin_right = 76.0
margin_bottom = 24.0
custom_constants/separation = 2
[node name="Label" type="Label" parent="DifficultySelect/VBoxContainer/HBoxContainer/Beginner"]
margin_right = 35.0
margin_bottom = 10.0
custom_fonts/font = ExtResource( 7 )
text = "Sweet"
[node name="BeginnerButton" type="TextureButton" parent="DifficultySelect/VBoxContainer/HBoxContainer/Beginner"]
unique_name_in_owner = true
margin_left = 17.0
margin_top = 12.0
margin_right = 17.0
margin_bottom = 24.0
rect_min_size = Vector2( 0, 12 )
focus_neighbour_right = NodePath("../../Advanced/AdvancedButton")
size_flags_horizontal = 4
texture_focused = ExtResource( 6 )
expand = true
stretch_mode = 3
[node name="Advanced" type="VBoxContainer" parent="DifficultySelect/VBoxContainer/HBoxContainer"]
margin_left = 84.0
margin_right = 119.0
margin_bottom = 24.0
custom_constants/separation = 2
[node name="Label" type="Label" parent="DifficultySelect/VBoxContainer/HBoxContainer/Advanced"]
margin_right = 35.0
margin_bottom = 10.0
custom_fonts/font = ExtResource( 7 )
text = "Spicy"
[node name="AdvancedButton" type="TextureButton" parent="DifficultySelect/VBoxContainer/HBoxContainer/Advanced"]
unique_name_in_owner = true
margin_left = 17.0
margin_top = 12.0
margin_right = 17.0
margin_bottom = 24.0
rect_min_size = Vector2( 0, 12 )
focus_neighbour_left = NodePath("../../Beginner/BeginnerButton")
focus_neighbour_right = NodePath("../../Professional/ProfessionalButton")
size_flags_horizontal = 4
texture_focused = ExtResource( 6 )
expand = true
stretch_mode = 3
[node name="Professional" type="VBoxContainer" parent="DifficultySelect/VBoxContainer/HBoxContainer"]
margin_left = 127.0
margin_right = 176.0
margin_bottom = 24.0
custom_constants/separation = 2
[node name="Label" type="Label" parent="DifficultySelect/VBoxContainer/HBoxContainer/Professional"]
margin_right = 49.0
margin_bottom = 10.0
custom_fonts/font = ExtResource( 7 )
text = "Pungent"
[node name="ProfessionalButton" type="TextureButton" parent="DifficultySelect/VBoxContainer/HBoxContainer/Professional"]
unique_name_in_owner = true
margin_left = 24.0
margin_top = 12.0
margin_right = 24.0
margin_bottom = 24.0
rect_min_size = Vector2( 0, 12 )
focus_neighbour_left = NodePath("../../Advanced/AdvancedButton")
size_flags_horizontal = 4
texture_focused = ExtResource( 6 )
expand = true
stretch_mode = 3
[node name="LivesSelect" type="PanelContainer" parent="."]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -66.0
margin_top = 7.0
margin_right = 66.0
margin_bottom = 39.0
[node name="VBoxContainer" type="VBoxContainer" parent="LivesSelect"]
margin_left = 3.0
margin_top = 3.0
margin_right = 129.0
margin_bottom = 29.0
custom_constants/separation = 0
[node name="Label" type="Label" parent="LivesSelect/VBoxContainer"]
material = ExtResource( 5 )
margin_right = 126.0
margin_bottom = 14.0
rect_min_size = Vector2( 0, 14 )
text = "number of lives:"
align = 1
valign = 1
[node name="HBoxContainer" type="HBoxContainer" parent="LivesSelect/VBoxContainer"]
margin_top = 14.0
margin_right = 126.0
margin_bottom = 26.0
rect_min_size = Vector2( 0, 12 )
size_flags_horizontal = 3
alignment = 1
[node name="BackArrow" type="TextureRect" parent="LivesSelect/VBoxContainer/HBoxContainer"]
visible = false
material = SubResource( 2 )
margin_left = 51.0
margin_top = 2.0
margin_right = 57.0
margin_bottom = 10.0
size_flags_vertical = 4
texture = ExtResource( 9 )
flip_h = true
[node name="SelectLives" type="Button" parent="LivesSelect/VBoxContainer/HBoxContainer"]
margin_left = 56.0
margin_right = 70.0
margin_bottom = 12.0
focus_neighbour_left = NodePath(".")
focus_neighbour_top = NodePath("../../../../DifficultySelect")
focus_neighbour_right = NodePath(".")
theme = ExtResource( 2 )
custom_colors/font_color = Color( 1, 1, 1, 1 )
custom_fonts/font = ExtResource( 7 )
text = "▬↨"
script = ExtResource( 10 )
[node name="NextArrow" type="TextureRect" parent="LivesSelect/VBoxContainer/HBoxContainer"]
visible = false
material = SubResource( 3 )
margin_left = 69.0
margin_top = 2.0
margin_right = 75.0
margin_bottom = 10.0
size_flags_vertical = 4
texture = ExtResource( 9 )
[connection signal="focus_entered" from="DifficultySelect" to="." method="_on_DifficultySelect_focus_entered"]
[connection signal="focus_entered" from="DifficultySelect/VBoxContainer/HBoxContainer/Beginner/BeginnerButton" to="." method="_set_difficulty" binds= [ 0 ]]
[connection signal="focus_entered" from="DifficultySelect/VBoxContainer/HBoxContainer/Advanced/AdvancedButton" to="." method="_set_difficulty" binds= [ 2 ]]
[connection signal="focus_entered" from="DifficultySelect/VBoxContainer/HBoxContainer/Professional/ProfessionalButton" to="." method="_set_difficulty" binds= [ 3 ]]
[connection signal="focus_entered" from="LivesSelect/VBoxContainer/HBoxContainer/SelectLives" to="LivesSelect/VBoxContainer/HBoxContainer/SelectLives" method="_on_focus_entered"]
[connection signal="focus_exited" from="LivesSelect/VBoxContainer/HBoxContainer/SelectLives" to="LivesSelect/VBoxContainer/HBoxContainer/SelectLives" method="_on_focus_exited"]

View file

@ -51,6 +51,15 @@ func final_score():
func _on_AnimationPlayer_animation_finished(anim_name):
if Game.marathon_mode:
Game.current_level += 1
if Game.current_level > LevelData.marathon_end:
Fade.fade_out(Options.transition_speed_secs)
yield(Fade, "fade_finished")
SceneManager.change_scene(load("res://menus/marathon_results.tscn").instance())
else:
Game.change_map(LevelData.levels[Game.current_level].scene)
return
Fade.fade_out(Options.transition_speed_secs)
yield(Fade, "fade_finished")
if Debug.is_cheating == false: