renamed game.golds into game.keys
This commit is contained in:
parent
bc57ba4171
commit
51a6a6c10d
7 changed files with 14 additions and 15 deletions
|
@ -4,7 +4,7 @@ var resolution = Vector2(256,192)
|
||||||
var current_sector = Vector2(0,0)
|
var current_sector = Vector2(0,0)
|
||||||
#Onreadys
|
#Onreadys
|
||||||
#Collectibles
|
#Collectibles
|
||||||
var golds = 0
|
var keys = 0
|
||||||
var stars = [false,false,false,false,false]
|
var stars = [false,false,false,false,false]
|
||||||
var shards = 0
|
var shards = 0
|
||||||
var arrows = 0
|
var arrows = 0
|
||||||
|
@ -60,7 +60,7 @@ func change_map(map: PackedScene):
|
||||||
#Clear data
|
#Clear data
|
||||||
func clear_collectibles():
|
func clear_collectibles():
|
||||||
score = 0
|
score = 0
|
||||||
golds = 0
|
keys = 0
|
||||||
stars = [false,false,false,false,false]
|
stars = [false,false,false,false,false]
|
||||||
shards = 0
|
shards = 0
|
||||||
shards_collected = [false,false,false,false,false,false,false,false,false,false]
|
shards_collected = [false,false,false,false,false,false,false,false,false,false]
|
||||||
|
@ -72,7 +72,7 @@ func clear_collectibles():
|
||||||
func save():
|
func save():
|
||||||
var save_id = LevelData.levels[current_level].save_id
|
var save_id = LevelData.levels[current_level].save_id
|
||||||
var save_data = Save.get_level_data(save_id)
|
var save_data = Save.get_level_data(save_id)
|
||||||
var is_100 = shards >= 5 && golds >= 50
|
var is_100 = shards >= 5 && keys >= 50
|
||||||
# set score and time depending on completion
|
# set score and time depending on completion
|
||||||
if score > save_data["score_100" if is_100 else "score_any"]:
|
if score > save_data["score_100" if is_100 else "score_any"]:
|
||||||
Save.set_score(save_id, score, is_100)
|
Save.set_score(save_id, score, is_100)
|
||||||
|
@ -103,7 +103,7 @@ func timeify(input):
|
||||||
func restart_level():
|
func restart_level():
|
||||||
if score > high_score: high_score = score
|
if score > high_score: high_score = score
|
||||||
score = 0
|
score = 0
|
||||||
golds = 0
|
keys = 0
|
||||||
stars = [false,false,false,false,false]
|
stars = [false,false,false,false,false]
|
||||||
shards = 0
|
shards = 0
|
||||||
arrows = 0
|
arrows = 0
|
||||||
|
@ -125,7 +125,7 @@ func freeze_frame(time):
|
||||||
|
|
||||||
#Check if 100%ed
|
#Check if 100%ed
|
||||||
func has_collection_bonus():
|
func has_collection_bonus():
|
||||||
return shards == 5 && golds == 50
|
return shards == 5 && keys == 50
|
||||||
|
|
||||||
# called when player dies
|
# called when player dies
|
||||||
func _on_player_died() -> void:
|
func _on_player_died() -> void:
|
||||||
|
|
|
@ -30,7 +30,7 @@ func _physics_process(delta):
|
||||||
if Input.is_action_just_pressed("restart"):
|
if Input.is_action_just_pressed("restart"):
|
||||||
Game.call_deferred("restart_level")
|
Game.call_deferred("restart_level")
|
||||||
|
|
||||||
if Game.golds == 50 && Game.shards == 5:
|
if Game.keys == 50 && Game.shards == 5:
|
||||||
#Time bonus
|
#Time bonus
|
||||||
collectible_bonus = true
|
collectible_bonus = true
|
||||||
#Time bonus
|
#Time bonus
|
||||||
|
|
|
@ -9,7 +9,7 @@ func _ready():
|
||||||
func _on_Area2D_area_entered(area):
|
func _on_Area2D_area_entered(area):
|
||||||
#Collect
|
#Collect
|
||||||
if area.is_in_group("player_hitbox"):
|
if area.is_in_group("player_hitbox"):
|
||||||
Game.golds += value
|
Game.keys += value
|
||||||
Game.score += 5
|
Game.score += 5
|
||||||
Audio.play_sound(Audio.a_gold,Audio.ac_collectible)
|
Audio.play_sound(Audio.a_gold,Audio.ac_collectible)
|
||||||
queue_free()
|
queue_free()
|
||||||
|
|
|
@ -21,7 +21,7 @@ func _ready():
|
||||||
|
|
||||||
func _physics_process(delta):
|
func _physics_process(delta):
|
||||||
#Open
|
#Open
|
||||||
if Game.golds >= cost: open = true
|
if Game.keys >= cost: open = true
|
||||||
if open == true:
|
if open == true:
|
||||||
sprite.region_rect.size.y -= 1
|
sprite.region_rect.size.y -= 1
|
||||||
if sprite.region_rect.size.y < 1: queue_free()
|
if sprite.region_rect.size.y < 1: queue_free()
|
||||||
|
|
|
@ -11,7 +11,7 @@ func _ready():
|
||||||
|
|
||||||
|
|
||||||
func _physics_process(delta):
|
func _physics_process(delta):
|
||||||
if Game.shards >= cost:
|
if Game.keys >= cost:
|
||||||
anims.play("open")
|
anims.play("open")
|
||||||
|
|
||||||
func _on_Area2D_area_entered(area):
|
func _on_Area2D_area_entered(area):
|
||||||
|
@ -19,13 +19,13 @@ func _on_Area2D_area_entered(area):
|
||||||
if Game.score > Game.high_score: Game.high_score = Game.score
|
if Game.score > Game.high_score: Game.high_score = Game.score
|
||||||
#BONUSES
|
#BONUSES
|
||||||
#Collection bonus
|
#Collection bonus
|
||||||
if Game.golds == 50: Game.score += 500
|
if Game.keys == 50: Game.score += 500
|
||||||
if Game.shards == 5: Game.score += 500
|
if Game.shards == 5: Game.score += 500
|
||||||
if Game.golds == 50 && Game.shards == 5:
|
if Game.keys == 50 && Game.shards == 5:
|
||||||
Game.score += 250
|
Game.score += 250
|
||||||
Game.shards_collected[5] = true
|
Game.shards_collected[5] = true
|
||||||
#Time bonus
|
#Time bonus
|
||||||
if Game.golds == 50 && Game.shards == 5:
|
if Game.keys == 50 && Game.shards == 5:
|
||||||
if Game.time < map.target_time_100:
|
if Game.time < map.target_time_100:
|
||||||
Game.score += max(2500 - 2500 * int(Game.time / map.target_time_100), 0)
|
Game.score += max(2500 - 2500 * int(Game.time / map.target_time_100), 0)
|
||||||
Game.shards_collected[6] = true
|
Game.shards_collected[6] = true
|
||||||
|
@ -39,7 +39,7 @@ func _on_Area2D_area_entered(area):
|
||||||
Game.score += 1500
|
Game.score += 1500
|
||||||
Game.shards_collected[7] = true
|
Game.shards_collected[7] = true
|
||||||
#Perfect bonus
|
#Perfect bonus
|
||||||
if Game.lives == 2 && Game.golds == 50 && Game.shards == 5 && Game.time < map.target_time_100:
|
if Game.lives == 2 && Game.keys == 50 && Game.shards == 5 && Game.time < map.target_time_100:
|
||||||
Game.score += 1000
|
Game.score += 1000
|
||||||
Game.save()
|
Game.save()
|
||||||
Game.change_map(load("res://maps/level_select.tscn"))
|
Game.change_map(load("res://maps/level_select.tscn"))
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
[ext_resource path="res://graphics/exit/exit.png" type="Texture" id=3]
|
[ext_resource path="res://graphics/exit/exit.png" type="Texture" id=3]
|
||||||
[ext_resource path="res://shaders/1px_border.gdshader" type="Shader" id=4]
|
[ext_resource path="res://shaders/1px_border.gdshader" type="Shader" id=4]
|
||||||
|
|
||||||
|
|
||||||
[sub_resource type="ShaderMaterial" id=1]
|
[sub_resource type="ShaderMaterial" id=1]
|
||||||
shader = ExtResource( 4 )
|
shader = ExtResource( 4 )
|
||||||
shader_param/border_color = Color( 0, 0, 0, 1 )
|
shader_param/border_color = Color( 0, 0, 0, 1 )
|
||||||
|
|
|
@ -28,7 +28,7 @@ func _ready():
|
||||||
|
|
||||||
func _physics_process(delta):
|
func _physics_process(delta):
|
||||||
#Gold Counter
|
#Gold Counter
|
||||||
gold_counter.text = "%02d" % Game.golds
|
gold_counter.text = "%02d" % Game.keys
|
||||||
#Shard Counter
|
#Shard Counter
|
||||||
shard_counter.text = str(Game.shards)
|
shard_counter.text = str(Game.shards)
|
||||||
#Star Counter
|
#Star Counter
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue