implement marathon start screen

This commit is contained in:
Haze Weathers 2023-12-30 21:02:39 -05:00
parent 048d63a353
commit db0a61e162
7 changed files with 267 additions and 53 deletions

View file

@ -44,7 +44,7 @@ var current_level: int = 0
var difficulty: int = Difficulty.SPICY setget _set_difficulty var difficulty: int = Difficulty.SPICY setget _set_difficulty
var enemy_speed_factor: float = 1.0 # multiplier of enemy speed var enemy_speed_factor: float = 1.0 # multiplier of enemy speed
var is_easy_mode: bool = false # whether to do easy-specific behaviors var is_easy_mode: bool = false # whether to do easy-specific behaviors
var use_lives: bool = false var use_lives: bool = true
var can_pause: bool = true var can_pause: bool = true
var can_restart: bool = true var can_restart: bool = true
var current_palette: String = "default" var current_palette: String = "default"
@ -53,6 +53,7 @@ var still_playing: bool = false
var marathon_mode: bool = true var marathon_mode: bool = true
var marathon_score: int = 0 var marathon_score: int = 0
var marathon_lives: int = 2 var marathon_lives: int = 2
var marathon_shards: int = 0
var next_level: PackedScene var next_level: PackedScene
func _ready(): func _ready():
@ -74,19 +75,19 @@ func _set_difficulty(value: int) -> void:
Difficulty.SWEET: Difficulty.SWEET:
is_easy_mode = true is_easy_mode = true
enemy_speed_factor = 0.75 enemy_speed_factor = 0.75
use_lives = false # use_lives = false
Difficulty.SALTY: Difficulty.SALTY:
is_easy_mode = false is_easy_mode = false
enemy_speed_factor = 1.0 enemy_speed_factor = 1.0
use_lives = false # use_lives = false
Difficulty.SPICY: Difficulty.SPICY:
is_easy_mode = false is_easy_mode = false
enemy_speed_factor = 1.0 enemy_speed_factor = 1.0
use_lives = true # use_lives = true
Difficulty.PUNGENT: Difficulty.PUNGENT:
is_easy_mode = false is_easy_mode = false
enemy_speed_factor = 1.25 enemy_speed_factor = 1.25
use_lives = true # use_lives = true
#Instances a node #Instances a node
func instance_node(node:PackedScene,x:float,y:float,parent): func instance_node(node:PackedScene,x:float,y:float,parent):
@ -138,6 +139,7 @@ func tally_scores() -> void:
# final score # final score
final_score = score + arrows_bonus + collection_bonus + time_bonus + life_bonus + perfect_bonus final_score = score + arrows_bonus + collection_bonus + time_bonus + life_bonus + perfect_bonus
marathon_score += final_score marathon_score += final_score
marathon_shards += _get_shards()
Game.save() Game.save()
@ -166,7 +168,8 @@ func clear_collectibles() -> void:
stars_collected.fill(false) stars_collected.fill(false)
shards_collected.fill(false) shards_collected.fill(false)
arrows = 0 arrows = 0
lives = marathon_lives if marathon_mode else 2 if not marathon_mode:
lives = 0
deaths = 0 deaths = 0
# score # score
score = 0 score = 0

View file

@ -0,0 +1,49 @@
extends Button
const INFINITY_SIGIL := "▬↨"
onready var back_arrow: TextureRect = $"../BackArrow"
onready var next_arrow: TextureRect = $"../NextArrow"
func _ready() -> void:
_update_display()
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

View file

@ -4,11 +4,31 @@ extends Control
export var first_level: PackedScene export var first_level: PackedScene
onready var difficulty_buttons := [
$"%BeginnerButton",
$"%AdvancedButton",
$"%AdvancedButton",
$"%ProfessionalButton",
]
func _ready() -> void: func _ready() -> void:
yield(get_tree(), "idle_frame")
difficulty_buttons[Game.difficulty].grab_focus()
Fade.fade_in() Fade.fade_in()
func _input(event: InputEvent) -> void: func _input(event: InputEvent) -> void:
if Input.is_action_just_pressed("ui_accept"): if Input.is_action_just_pressed("ui_accept"):
Game.lives = Game.marathon_lives
Game.marathon_score = 0 Game.marathon_score = 0
Game.marathon_shards = 0
Game.change_map(first_level) Game.change_map(first_level)
func _set_difficulty(difficulty: int) -> void:
Game.difficulty = difficulty
func _on_DifficultySelect_focus_entered() -> void:
difficulty_buttons[Game.difficulty].grab_focus()

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=8 format=2] [gd_scene load_steps=14 format=2]
[ext_resource path="res://shaders/ska_plane.gdshader" type="Shader" id=1] [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://ui/theme.tres" type="Theme" id=2]
@ -6,6 +6,10 @@
[ext_resource path="res://maps/hills_scholar.tscn" type="PackedScene" id=4] [ext_resource path="res://maps/hills_scholar.tscn" type="PackedScene" id=4]
[ext_resource path="res://ui/2ndpuberty_outline.tres" type="Material" id=5] [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://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] [sub_resource type="ShaderMaterial" id=1]
shader = ExtResource( 1 ) shader = ExtResource( 1 )
@ -17,6 +21,20 @@ shader_param/cycle_speed = Vector2( 4, 4 )
shader_param/cycle_alternation = Vector2( 4, 4 ) shader_param/cycle_alternation = Vector2( 4, 4 )
shader_param/uv_transform = Transform2D( 1, 0, 1, 1, 0, 0 ) 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"] [node name="MarathonStart" type="Control"]
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
@ -50,64 +68,188 @@ in revolution 2083 world"
align = 1 align = 1
valign = 1 valign = 1
[node name="Panel" type="Panel" parent="."] [node name="DifficultySelect" type="PanelContainer" parent="."]
anchor_left = 0.5 anchor_left = 0.5
anchor_top = 0.5 anchor_top = 0.5
anchor_right = 0.5 anchor_right = 0.5
anchor_bottom = 0.5 anchor_bottom = 0.5
margin_left = -112.0 margin_left = -112.0
margin_top = -32.0 margin_top = -48.0
margin_right = 112.0 margin_right = 112.0
margin_bottom = 4.0 focus_mode = 2
[node name="DiffcultySelect" type="Label" parent="Panel"] [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 ) material = ExtResource( 5 )
anchor_right = 1.0 margin_right = 218.0
margin_left = -4.0 margin_bottom = 14.0
margin_top = -26.0 rect_min_size = Vector2( 0, 14 )
margin_right = 4.0 text = "difficulty select:"
margin_bottom = 7.0
text = "difficulty select"
align = 1 align = 1
valign = 1 valign = 1
[node name="Difficulties" type="Label" parent="Panel"] [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 = 3.0
margin_right = 59.0
margin_bottom = 24.0
custom_constants/separation = 2
[node name="Label" type="Label" parent="DifficultySelect/VBoxContainer/HBoxContainer/Beginner"]
margin_right = 56.0
margin_bottom = 10.0
custom_fonts/font = ExtResource( 7 )
text = "Beginner"
[node name="BeginnerButton" type="TextureButton" parent="DifficultySelect/VBoxContainer/HBoxContainer/Beginner"]
unique_name_in_owner = true
material = ExtResource( 5 ) material = ExtResource( 5 )
anchor_right = 1.0 margin_left = 28.0
margin_left = -44.0 margin_top = 12.0
margin_top = -2.0 margin_right = 28.0
margin_right = 46.0 margin_bottom = 24.0
margin_bottom = 31.0 rect_min_size = Vector2( 0, 12 )
text = "Beginner Advanced Professional" 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 = 67.0
margin_right = 123.0
margin_bottom = 24.0
custom_constants/separation = 2
[node name="Label" type="Label" parent="DifficultySelect/VBoxContainer/HBoxContainer/Advanced"]
margin_right = 56.0
margin_bottom = 10.0
custom_fonts/font = ExtResource( 7 )
text = "Advanced"
[node name="AdvancedButton" type="TextureButton" parent="DifficultySelect/VBoxContainer/HBoxContainer/Advanced"]
unique_name_in_owner = true
material = ExtResource( 5 )
margin_left = 28.0
margin_top = 12.0
margin_right = 28.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 = 131.0
margin_right = 215.0
margin_bottom = 24.0
custom_constants/separation = 2
[node name="Label" type="Label" parent="DifficultySelect/VBoxContainer/HBoxContainer/Professional"]
margin_right = 84.0
margin_bottom = 10.0
custom_fonts/font = ExtResource( 7 )
text = "Professional"
[node name="ProfessionalButton" type="TextureButton" parent="DifficultySelect/VBoxContainer/HBoxContainer/Professional"]
unique_name_in_owner = true
material = ExtResource( 5 )
margin_left = 42.0
margin_top = 12.0
margin_right = 42.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 align = 1
valign = 1 valign = 1
[node name="Sprite" type="Sprite" parent="Panel"] [node name="HBoxContainer" type="HBoxContainer" parent="LivesSelect/VBoxContainer"]
material = ExtResource( 5 ) margin_top = 14.0
position = Vector2( 32, 26 ) margin_right = 126.0
texture = ExtResource( 6 ) margin_bottom = 26.0
rect_min_size = Vector2( 0, 12 )
size_flags_horizontal = 3
alignment = 1
[node name="Panel2" type="Panel" parent="."] [node name="BackArrow" type="TextureRect" parent="LivesSelect/VBoxContainer/HBoxContainer"]
margin_left = 96.0 visible = false
margin_top = 120.0 material = SubResource( 2 )
margin_right = 160.0 margin_left = 51.0
margin_bottom = 152.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="LivesNumber" type="Label" parent="Panel2"] [node name="SelectLives" type="Button" parent="LivesSelect/VBoxContainer/HBoxContainer"]
material = ExtResource( 5 ) margin_left = 56.0
anchor_right = 1.0 margin_right = 70.0
margin_bottom = 33.0 margin_bottom = 12.0
text = "999" focus_neighbour_left = NodePath(".")
align = 1 focus_neighbour_top = NodePath("../../../../DifficultySelect")
valign = 1 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="Lives" type="Label" parent="Panel2"] [node name="NextArrow" type="TextureRect" parent="LivesSelect/VBoxContainer/HBoxContainer"]
material = ExtResource( 5 ) visible = false
anchor_right = 1.0 material = SubResource( 3 )
margin_left = -24.0 margin_left = 69.0
margin_top = -24.0 margin_top = 2.0
margin_right = 17.0 margin_right = 75.0
margin_bottom = 9.0 margin_bottom = 10.0
text = "Number of lives" size_flags_vertical = 4
align = 1 texture = ExtResource( 9 )
valign = 1
[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

@ -72,7 +72,7 @@ func _physics_process(delta):
else: else:
lives_counter.text = str(Game.deaths) lives_counter.text = str(Game.deaths)
#Life bonus color #Life bonus color
if Game.lives == 2: if Game.deaths == 0:
lives_counter.modulate = bonus_color lives_counter.modulate = bonus_color
else: else:
lives_counter.modulate = Color.white lives_counter.modulate = Color.white

View file

@ -81,7 +81,7 @@ margin_bottom = 32.0
unique_name_in_owner = true unique_name_in_owner = true
margin_top = 36.0 margin_top = 36.0
margin_right = 218.0 margin_right = 218.0
margin_bottom = 132.0 margin_bottom = 116.0
focus_mode = 2 focus_mode = 2
tabs_visible = false tabs_visible = false
@ -138,7 +138,6 @@ script = ExtResource( 3 )
options = [ "none", "no stains", "full" ] options = [ "none", "no stains", "full" ]
[node name="Video" type="VBoxContainer" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/Tabs"] [node name="Video" type="VBoxContainer" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/Tabs"]
visible = false
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
focus_next = NodePath("Fullscreen/SelectFullscreen") focus_next = NodePath("Fullscreen/SelectFullscreen")
@ -443,6 +442,7 @@ script = ExtResource( 3 )
options = [ "off", "on" ] options = [ "off", "on" ]
[node name="Input" type="VBoxContainer" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/Tabs"] [node name="Input" type="VBoxContainer" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/Tabs"]
visible = false
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
focus_next = NodePath("Left/Keyboard") focus_next = NodePath("Left/Keyboard")

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

Before After
Before After