From 22a53ee1a01de23ccc1e103647ebbc5b78e760f4 Mon Sep 17 00:00:00 2001 From: Haze Weathers Date: Fri, 29 Dec 2023 15:26:02 -0500 Subject: [PATCH] marathon mode skeleton --- autoloads/game.gd | 6 ++-- cutscenes/intro_story.gd | 4 +-- maps/boss/boss1_arena.tscn | 2 +- menus/marathon_results.gd | 14 +++++++++ menus/marathon_results.tscn | 52 ++++++++++++++++++++++++++++++++ menus/marathon_start.gd | 14 +++++++++ menus/marathon_start.tscn | 55 ++++++++++++++++++++++++++++++++++ objects/enemy/boss/scrump.tscn | 1 - objects/hud/3d_text.tscn | 12 ++++---- 9 files changed, 147 insertions(+), 13 deletions(-) create mode 100644 menus/marathon_results.gd create mode 100644 menus/marathon_results.tscn create mode 100644 menus/marathon_start.gd create mode 100644 menus/marathon_start.tscn diff --git a/autoloads/game.gd b/autoloads/game.gd index 443ef4b..9b9546d 100644 --- a/autoloads/game.gd +++ b/autoloads/game.gd @@ -51,6 +51,8 @@ var current_palette: String = "default" var still_playing: bool = false # demo hack marathon mode var marathon_mode: bool = true +var marathon_score: int = 0 +var marathon_lives: int = 2 var next_level: PackedScene func _ready(): @@ -135,7 +137,7 @@ func tally_scores() -> void: perfect_bonus += 1000 # final score final_score = score + arrows_bonus + collection_bonus + time_bonus + life_bonus + perfect_bonus - print(collection_bonus) + marathon_score += final_score Game.save() @@ -164,7 +166,7 @@ func clear_collectibles() -> void: stars_collected.fill(false) shards_collected.fill(false) arrows = 0 - lives = 2 + lives = marathon_lives if marathon_mode else 2 deaths = 0 # score score = 0 diff --git a/cutscenes/intro_story.gd b/cutscenes/intro_story.gd index fcd9421..8ff6c04 100644 --- a/cutscenes/intro_story.gd +++ b/cutscenes/intro_story.gd @@ -9,9 +9,9 @@ func _input(event): if Input.is_action_just_pressed("ui_accept"): Fade.fade_out(0.4) 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): Fade.fade_out(0.4) yield(Fade, "fade_finished") - SceneManager.current_scene = load("res://maps/level_select.tscn").instance() + SceneManager.current_scene = load("res://menus/marathon_start.tscn").instance() diff --git a/maps/boss/boss1_arena.tscn b/maps/boss/boss1_arena.tscn index dc4b540..30ab39b 100644 --- a/maps/boss/boss1_arena.tscn +++ b/maps/boss/boss1_arena.tscn @@ -16,7 +16,7 @@ [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://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"]] pause_mode = 1 diff --git a/menus/marathon_results.gd b/menus/marathon_results.gd new file mode 100644 index 0000000..1b162ec --- /dev/null +++ b/menus/marathon_results.gd @@ -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")) diff --git a/menus/marathon_results.tscn b/menus/marathon_results.tscn new file mode 100644 index 0000000..5885edb --- /dev/null +++ b/menus/marathon_results.tscn @@ -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 diff --git a/menus/marathon_start.gd b/menus/marathon_start.gd new file mode 100644 index 0000000..4d4bccc --- /dev/null +++ b/menus/marathon_start.gd @@ -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) diff --git a/menus/marathon_start.tscn b/menus/marathon_start.tscn new file mode 100644 index 0000000..51a46fe --- /dev/null +++ b/menus/marathon_start.tscn @@ -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 diff --git a/objects/enemy/boss/scrump.tscn b/objects/enemy/boss/scrump.tscn index 8e322a5..e020b45 100644 --- a/objects/enemy/boss/scrump.tscn +++ b/objects/enemy/boss/scrump.tscn @@ -96,7 +96,6 @@ autostart = true [node name="Sprite" type="AnimatedSprite" parent="."] position = Vector2( 26, 27 ) frames = SubResource( 5 ) -frame = 1 playing = true [node name="BloodPosition" type="Position2D" parent="."] diff --git a/objects/hud/3d_text.tscn b/objects/hud/3d_text.tscn index 8a6a0f8..da91231 100644 --- a/objects/hud/3d_text.tscn +++ b/objects/hud/3d_text.tscn @@ -6,17 +6,11 @@ [ext_resource path="res://ui/Boba Date.otf" type="DynamicFontData" id=4] [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] font_data = ExtResource( 1 ) [sub_resource type="TextMesh" id=2] resource_local_to_scene = true -material = SubResource( 11 ) text = "TEXT" font = SubResource( 19 ) pixel_size = 0.05 @@ -185,6 +179,11 @@ tracks/4/keys = { "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] resource_name = "final score" tracks/0/type = "value" @@ -658,7 +657,6 @@ anchor_right = 1.0 anchor_bottom = 1.0 script = ExtResource( 2 ) text = "TEXT" -text_material = SubResource( 11 ) [node name="Viewport" type="Viewport" parent="."] size = Vector2( 256, 192 )