forked from team-sg/hero-mark-2
implement level requirements (closes #206)
This commit is contained in:
parent
f263ce7842
commit
e9583ecada
3 changed files with 74 additions and 11 deletions
|
@ -61,7 +61,7 @@ script = ExtResource( 5 )
|
||||||
title = "VS The Scrump"
|
title = "VS The Scrump"
|
||||||
shard_titles = [ "-w-", "owo", "uwu", "o3o", "5 Rainbow Stars", "Collection Bonus", "Time Bonus", "Life Bonus" ]
|
shard_titles = [ "-w-", "owo", "uwu", "o3o", "5 Rainbow Stars", "Collection Bonus", "Time Bonus", "Life Bonus" ]
|
||||||
save_id = "boss1"
|
save_id = "boss1"
|
||||||
shards_required = 0
|
shards_required = 4
|
||||||
boss_required = ""
|
boss_required = ""
|
||||||
boss = true
|
boss = true
|
||||||
scores_id = -1
|
scores_id = -1
|
||||||
|
@ -113,7 +113,7 @@ script = ExtResource( 5 )
|
||||||
title = "VS. STG-2600"
|
title = "VS. STG-2600"
|
||||||
shard_titles = [ "", "", "", "", "5 Rainbow Stars", "Collection Bonus", "Time Bonus", "Life Bonus" ]
|
shard_titles = [ "", "", "", "", "5 Rainbow Stars", "Collection Bonus", "Time Bonus", "Life Bonus" ]
|
||||||
save_id = "boss2"
|
save_id = "boss2"
|
||||||
shards_required = 0
|
shards_required = 8
|
||||||
boss_required = ""
|
boss_required = ""
|
||||||
boss = true
|
boss = true
|
||||||
scores_id = -1
|
scores_id = -1
|
||||||
|
@ -165,7 +165,7 @@ script = ExtResource( 5 )
|
||||||
title = "Beta Verdant Hills"
|
title = "Beta Verdant Hills"
|
||||||
shard_titles = [ "Climb the Big Vine", "Next to the Lone Tree", "Slime's Treasure", "The Snake Pit", "5 Rainbow Stars", "Collection Bonus", "Time Bonus", "Life Bonus" ]
|
shard_titles = [ "Climb the Big Vine", "Next to the Lone Tree", "Slime's Treasure", "The Snake Pit", "5 Rainbow Stars", "Collection Bonus", "Time Bonus", "Life Bonus" ]
|
||||||
save_id = "beta_hills"
|
save_id = "beta_hills"
|
||||||
shards_required = 0
|
shards_required = 72
|
||||||
boss_required = ""
|
boss_required = ""
|
||||||
boss = false
|
boss = false
|
||||||
scores_id = -1
|
scores_id = -1
|
||||||
|
@ -178,7 +178,7 @@ script = ExtResource( 5 )
|
||||||
title = "Beta Blue Ray Cavern"
|
title = "Beta Blue Ray Cavern"
|
||||||
shard_titles = [ "Star-Crossed Lovers", "The Snail Cave", "Members Only!", "OverHead Obstacle Course", "5 Rainbow Stars", "Collection Bonus", "Time Bonus", "Life Bonus" ]
|
shard_titles = [ "Star-Crossed Lovers", "The Snail Cave", "Members Only!", "OverHead Obstacle Course", "5 Rainbow Stars", "Collection Bonus", "Time Bonus", "Life Bonus" ]
|
||||||
save_id = "beta_cave"
|
save_id = "beta_cave"
|
||||||
shards_required = 0
|
shards_required = 72
|
||||||
boss_required = ""
|
boss_required = ""
|
||||||
boss = false
|
boss = false
|
||||||
scores_id = -1
|
scores_id = -1
|
||||||
|
|
|
@ -24,6 +24,8 @@ onready var filled_shards: Node2D = $"%FilledShards"
|
||||||
onready var shard_title: Label = $"%ShardTitle"
|
onready var shard_title: Label = $"%ShardTitle"
|
||||||
onready var shard_arrow: Sprite = $"%ShardArrow"
|
onready var shard_arrow: Sprite = $"%ShardArrow"
|
||||||
onready var animation_player: AnimationPlayer = $AnimationPlayer
|
onready var animation_player: AnimationPlayer = $AnimationPlayer
|
||||||
|
onready var forward_status: TabContainer = $"%ForwardStatus"
|
||||||
|
onready var shards_required: Label = $"%ShardsRequired"
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
Fade.fade_in(0.4)
|
Fade.fade_in(0.4)
|
||||||
|
@ -89,7 +91,15 @@ func _input(event: InputEvent) -> void:
|
||||||
shard_arrow.position.x = filled_shards.get_child(selected_shard).position.x
|
shard_arrow.position.x = filled_shards.get_child(selected_shard).position.x
|
||||||
|
|
||||||
func _select_level(level_id: int) -> void:
|
func _select_level(level_id: int) -> void:
|
||||||
var level = LevelData.levels[level_id]
|
var level: LevelEntry = LevelData.levels[level_id]
|
||||||
|
# fail if required boss is not beaten
|
||||||
|
if not level.boss_required.empty():
|
||||||
|
var boss_save = Save.current_file.levels[level.boss_required]
|
||||||
|
if not boss_save.completed:
|
||||||
|
return
|
||||||
|
# fail if not enough shards
|
||||||
|
if Save.current_file.get_total_shards() < level.shards_required:
|
||||||
|
return
|
||||||
selected_level = level_id
|
selected_level = level_id
|
||||||
# hide arrows at edges of leve set
|
# hide arrows at edges of leve set
|
||||||
if level_id == 0:
|
if level_id == 0:
|
||||||
|
@ -97,9 +107,19 @@ func _select_level(level_id: int) -> void:
|
||||||
else:
|
else:
|
||||||
back_arrow.modulate.a = 1.0
|
back_arrow.modulate.a = 1.0
|
||||||
if level_id == LevelData.levels.size() - 1:
|
if level_id == LevelData.levels.size() - 1:
|
||||||
|
forward_status.current_tab = 0
|
||||||
forward_arrow.modulate.a = 0.0
|
forward_arrow.modulate.a = 0.0
|
||||||
else:
|
else:
|
||||||
|
forward_status.current_tab = 0
|
||||||
forward_arrow.modulate.a = 1.0
|
forward_arrow.modulate.a = 1.0
|
||||||
|
var next_level = LevelData.levels[level_id + 1]
|
||||||
|
if Save.current_file.get_total_shards() < next_level.shards_required:
|
||||||
|
forward_status.current_tab = 1
|
||||||
|
shards_required.text = str(next_level.shards_required)
|
||||||
|
if not next_level.boss_required.empty():
|
||||||
|
var boss_save = Save.current_file.levels[next_level.boss_required]
|
||||||
|
if not boss_save.completed:
|
||||||
|
forward_status.current_tab = 2
|
||||||
# set text
|
# set text
|
||||||
level_title.text = level.title
|
level_title.text = level.title
|
||||||
# initiate animation
|
# initiate animation
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=19 format=2]
|
[gd_scene load_steps=22 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://menus/level_select_scholar.gd" type="Script" id=1]
|
[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]
|
[ext_resource path="res://graphics/level_select/world_map.png" type="Texture" id=2]
|
||||||
|
@ -7,9 +7,11 @@
|
||||||
[ext_resource path="res://graphics/hud/pause_arrow.png" type="Texture" id=5]
|
[ext_resource path="res://graphics/hud/pause_arrow.png" type="Texture" id=5]
|
||||||
[ext_resource path="res://ui/2ndpuberty_outline.tres" type="Material" id=6]
|
[ext_resource path="res://ui/2ndpuberty_outline.tres" type="Material" id=6]
|
||||||
[ext_resource path="res://shaders/wibble_wobble.gdshader" type="Shader" id=7]
|
[ext_resource path="res://shaders/wibble_wobble.gdshader" type="Shader" id=7]
|
||||||
|
[ext_resource path="res://ui/2ndpuberty_scholar_outline.fnt" type="BitmapFont" id=8]
|
||||||
[ext_resource path="res://shaders/1px_border.gdshader" type="Shader" id=9]
|
[ext_resource path="res://shaders/1px_border.gdshader" type="Shader" id=9]
|
||||||
[ext_resource path="res://graphics/collectibles/shard.png" type="Texture" id=10]
|
[ext_resource path="res://graphics/collectibles/shard.png" type="Texture" id=10]
|
||||||
[ext_resource path="res://objects/collectibles/shard.tscn" type="PackedScene" id=11]
|
[ext_resource path="res://objects/collectibles/shard.tscn" type="PackedScene" id=11]
|
||||||
|
[ext_resource path="res://graphics/falling_block/woeful_soul.png" type="Texture" id=12]
|
||||||
[ext_resource path="res://graphics/hud/levelselect_arrow.png" type="Texture" id=14]
|
[ext_resource path="res://graphics/hud/levelselect_arrow.png" type="Texture" id=14]
|
||||||
|
|
||||||
[sub_resource type="Curve2D" id=1]
|
[sub_resource type="Curve2D" id=1]
|
||||||
|
@ -31,6 +33,10 @@ shader_param/ammount = Vector2( 2, 0 )
|
||||||
shader_param/offset = Vector2( 0, 0 )
|
shader_param/offset = Vector2( 0, 0 )
|
||||||
shader_param/delay = Vector2( 4, 0 )
|
shader_param/delay = Vector2( 4, 0 )
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id=9]
|
||||||
|
atlas = ExtResource( 12 )
|
||||||
|
region = Rect2( 8, 0, 8, 8 )
|
||||||
|
|
||||||
[sub_resource type="ShaderMaterial" id=5]
|
[sub_resource type="ShaderMaterial" id=5]
|
||||||
shader = ExtResource( 9 )
|
shader = ExtResource( 9 )
|
||||||
shader_param/border_color = Color( 0, 0, 0, 1 )
|
shader_param/border_color = Color( 0, 0, 0, 1 )
|
||||||
|
@ -203,6 +209,7 @@ offset = 300.0
|
||||||
[node name="CurrentLevel" type="HBoxContainer" parent="."]
|
[node name="CurrentLevel" type="HBoxContainer" parent="."]
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
margin_bottom = 16.0
|
margin_bottom = 16.0
|
||||||
|
theme = ExtResource( 4 )
|
||||||
alignment = 1
|
alignment = 1
|
||||||
|
|
||||||
[node name="BackArrow" type="TextureRect" parent="CurrentLevel"]
|
[node name="BackArrow" type="TextureRect" parent="CurrentLevel"]
|
||||||
|
@ -228,15 +235,51 @@ text = "Verdant Hills"
|
||||||
align = 1
|
align = 1
|
||||||
valign = 1
|
valign = 1
|
||||||
|
|
||||||
[node name="ForwardArrow" type="TextureRect" parent="CurrentLevel"]
|
[node name="ForwardStatus" type="TabContainer" parent="CurrentLevel"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
margin_left = 177.0
|
||||||
|
margin_right = 183.0
|
||||||
|
margin_bottom = 16.0
|
||||||
|
tabs_visible = false
|
||||||
|
|
||||||
|
[node name="ForwardArrow" type="TextureRect" parent="CurrentLevel/ForwardStatus"]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
material = SubResource( 3 )
|
material = SubResource( 3 )
|
||||||
margin_left = 177.0
|
anchor_right = 1.0
|
||||||
margin_top = 4.0
|
anchor_bottom = 1.0
|
||||||
margin_right = 183.0
|
|
||||||
margin_bottom = 12.0
|
|
||||||
size_flags_vertical = 4
|
size_flags_vertical = 4
|
||||||
texture = ExtResource( 5 )
|
texture = ExtResource( 5 )
|
||||||
|
stretch_mode = 4
|
||||||
|
|
||||||
|
[node name="NotEnoughShards" type="HBoxContainer" parent="CurrentLevel/ForwardStatus"]
|
||||||
|
visible = false
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
|
||||||
|
[node name="Shard" type="TextureRect" parent="CurrentLevel/ForwardStatus/NotEnoughShards"]
|
||||||
|
material = ExtResource( 6 )
|
||||||
|
margin_top = 2.0
|
||||||
|
margin_right = 11.0
|
||||||
|
margin_bottom = 13.0
|
||||||
|
size_flags_vertical = 4
|
||||||
|
texture = ExtResource( 10 )
|
||||||
|
|
||||||
|
[node name="ShardsRequired" type="Label" parent="CurrentLevel/ForwardStatus/NotEnoughShards"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
margin_left = 15.0
|
||||||
|
margin_top = 3.0
|
||||||
|
margin_right = 29.0
|
||||||
|
margin_bottom = 13.0
|
||||||
|
custom_colors/font_color = Color( 0.960784, 0.2, 0.258824, 1 )
|
||||||
|
custom_fonts/font = ExtResource( 8 )
|
||||||
|
text = "20"
|
||||||
|
|
||||||
|
[node name="BossNotBeaten" type="TextureRect" parent="CurrentLevel/ForwardStatus"]
|
||||||
|
visible = false
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
texture = SubResource( 9 )
|
||||||
|
stretch_mode = 4
|
||||||
|
|
||||||
[node name="LevelStats" type="Panel" parent="."]
|
[node name="LevelStats" type="Panel" parent="."]
|
||||||
visible = false
|
visible = false
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue