marathon mode skeleton

This commit is contained in:
Haze Weathers 2023-12-29 15:26:02 -05:00
parent 6bd0a81f11
commit 22a53ee1a0
9 changed files with 147 additions and 13 deletions

View file

@ -51,6 +51,8 @@ var current_palette: String = "default"
var still_playing: bool = false var still_playing: bool = false
# demo hack marathon mode # demo hack marathon mode
var marathon_mode: bool = true var marathon_mode: bool = true
var marathon_score: int = 0
var marathon_lives: int = 2
var next_level: PackedScene var next_level: PackedScene
func _ready(): func _ready():
@ -135,7 +137,7 @@ func tally_scores() -> void:
perfect_bonus += 1000 perfect_bonus += 1000
# 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
print(collection_bonus) marathon_score += final_score
Game.save() Game.save()
@ -164,7 +166,7 @@ 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 = 2 lives = marathon_lives if marathon_mode else 2
deaths = 0 deaths = 0
# score # score
score = 0 score = 0

View file

@ -9,9 +9,9 @@ func _input(event):
if Input.is_action_just_pressed("ui_accept"): if Input.is_action_just_pressed("ui_accept"):
Fade.fade_out(0.4) Fade.fade_out(0.4)
yield(Fade, "fade_finished") yield(Fade, "fade_finished")
SceneManager.current_scene = load("res://maps/level_select.tscn").instance() SceneManager.current_scene = load("res://menus/marathon_start.tscn").instance()
func _on_AnimationPlayer_animation_finished(anim_name): func _on_AnimationPlayer_animation_finished(anim_name):
Fade.fade_out(0.4) Fade.fade_out(0.4)
yield(Fade, "fade_finished") yield(Fade, "fade_finished")
SceneManager.current_scene = load("res://maps/level_select.tscn").instance() SceneManager.current_scene = load("res://menus/marathon_start.tscn").instance()

View file

@ -16,7 +16,7 @@
[ext_resource path="res://tilesets/t_ladders.tres" type="TileSet" id=14] [ext_resource path="res://tilesets/t_ladders.tres" type="TileSet" id=14]
[ext_resource path="res://shaders/can_stain.tres" type="Material" id=15] [ext_resource path="res://shaders/can_stain.tres" type="Material" id=15]
[ext_resource path="res://objects/lore/boss/the_scrump.tscn" type="PackedScene" id=16] [ext_resource path="res://objects/lore/boss/the_scrump.tscn" type="PackedScene" id=16]
[ext_resource path="res://maps/level_select.tscn" type="PackedScene" id=17] [ext_resource path="res://menus/marathon_results.tscn" type="PackedScene" id=17]
[node name="Map" type="Node2D" groups=["map"]] [node name="Map" type="Node2D" groups=["map"]]
pause_mode = 1 pause_mode = 1

14
menus/marathon_results.gd Normal file
View file

@ -0,0 +1,14 @@
extends Control
onready var score: Label = $"%Score"
func _ready() -> void:
Fade.fade_in()
score.text = score.text % Game.marathon_score
func _input(event: InputEvent) -> void:
if Input.is_action_just_pressed("ui_accept"):
Game.change_map(load("res://menus/marathon_start.tscn"))

View file

@ -0,0 +1,52 @@
[gd_scene load_steps=5 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]
[sub_resource type="ShaderMaterial" id=1]
shader = ExtResource( 1 )
shader_param/color_1 = Color( 1, 0.654902, 0.172549, 1 )
shader_param/color_2 = Color( 0.309804, 0.984314, 0.937255, 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 = -30.0
margin_right = 60.0
margin_bottom = 30.0
[node name="Label" type="Label" parent="Panel"]
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
anchor_right = 1.0
margin_top = 21.0
margin_bottom = 43.0
text = "Score: %05d"
align = 1
valign = 1

14
menus/marathon_start.gd Normal file
View file

@ -0,0 +1,14 @@
extends Control
export var first_level: PackedScene
func _ready() -> void:
Fade.fade_in()
func _input(event: InputEvent) -> void:
if Input.is_action_just_pressed("ui_accept"):
Game.marathon_score = 0
Game.change_map(first_level)

55
menus/marathon_start.tscn Normal file
View file

@ -0,0 +1,55 @@
[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_start.gd" type="Script" id=3]
[ext_resource path="res://maps/hills_scholar.tscn" type="PackedScene" id=4]
[sub_resource type="ShaderMaterial" id=1]
shader = ExtResource( 1 )
shader_param/color_1 = Color( 0.886275, 1, 0.498039, 1 )
shader_param/color_2 = Color( 0.180392, 0.992157, 0.447059, 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="MarathonStart" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
theme = ExtResource( 2 )
script = ExtResource( 3 )
first_level = ExtResource( 4 )
[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 = -30.0
margin_right = 60.0
margin_bottom = 30.0
[node name="Label" type="Label" parent="Panel"]
anchor_right = 1.0
margin_bottom = 22.0
text = "Press X to start"
align = 1
valign = 1
[node name="Label2" type="Label" parent="Panel"]
anchor_right = 1.0
margin_left = 1.0
margin_top = 22.0
margin_right = 1.0
margin_bottom = 55.0
text = "Todo: options"
align = 1
valign = 1

View file

@ -96,7 +96,6 @@ autostart = true
[node name="Sprite" type="AnimatedSprite" parent="."] [node name="Sprite" type="AnimatedSprite" parent="."]
position = Vector2( 26, 27 ) position = Vector2( 26, 27 )
frames = SubResource( 5 ) frames = SubResource( 5 )
frame = 1
playing = true playing = true
[node name="BloodPosition" type="Position2D" parent="."] [node name="BloodPosition" type="Position2D" parent="."]

View file

@ -6,17 +6,11 @@
[ext_resource path="res://ui/Boba Date.otf" type="DynamicFontData" id=4] [ext_resource path="res://ui/Boba Date.otf" type="DynamicFontData" id=4]
[ext_resource path="res://ui/HooskaiChamferedSquare.ttf" type="DynamicFontData" id=5] [ext_resource path="res://ui/HooskaiChamferedSquare.ttf" type="DynamicFontData" id=5]
[sub_resource type="SpatialMaterial" id=11]
albedo_color = Color( 0.309804, 0.690196, 0.380392, 1 )
metallic = 0.35
metallic_specular = 0.11
[sub_resource type="DynamicFont" id=19] [sub_resource type="DynamicFont" id=19]
font_data = ExtResource( 1 ) font_data = ExtResource( 1 )
[sub_resource type="TextMesh" id=2] [sub_resource type="TextMesh" id=2]
resource_local_to_scene = true resource_local_to_scene = true
material = SubResource( 11 )
text = "TEXT" text = "TEXT"
font = SubResource( 19 ) font = SubResource( 19 )
pixel_size = 0.05 pixel_size = 0.05
@ -185,6 +179,11 @@ tracks/4/keys = {
"values": [ ExtResource( 4 ) ] "values": [ ExtResource( 4 ) ]
} }
[sub_resource type="SpatialMaterial" id=11]
albedo_color = Color( 0.309804, 0.690196, 0.380392, 1 )
metallic = 0.35
metallic_specular = 0.11
[sub_resource type="Animation" id=20] [sub_resource type="Animation" id=20]
resource_name = "final score" resource_name = "final score"
tracks/0/type = "value" tracks/0/type = "value"
@ -658,7 +657,6 @@ anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
script = ExtResource( 2 ) script = ExtResource( 2 )
text = "TEXT" text = "TEXT"
text_material = SubResource( 11 )
[node name="Viewport" type="Viewport" parent="."] [node name="Viewport" type="Viewport" parent="."]
size = Vector2( 256, 192 ) size = Vector2( 256, 192 )