add falling block
This commit is contained in:
parent
d6547b61d4
commit
54f0880864
20 changed files with 153 additions and 26 deletions
45
objects/environment/exit/exit.gd
Normal file
45
objects/environment/exit/exit.gd
Normal file
|
@ -0,0 +1,45 @@
|
|||
extends Node2D
|
||||
|
||||
export var cost = 0
|
||||
onready var label = $Label
|
||||
onready var anims = $AnimationPlayer
|
||||
onready var map = get_owner()
|
||||
|
||||
func _ready():
|
||||
anims.play("closed")
|
||||
label.text = str(cost)
|
||||
|
||||
|
||||
func _physics_process(delta):
|
||||
if Game.shards >= cost:
|
||||
anims.play("open")
|
||||
|
||||
func _on_Area2D_area_entered(area):
|
||||
if area.is_in_group("player"):
|
||||
if Game.score > Game.high_score: Game.high_score = Game.score
|
||||
#BONUSES
|
||||
#Collection bonus
|
||||
if Game.golds == 50: Game.score += 500
|
||||
if Game.shards == 5: Game.score += 500
|
||||
if Game.golds == 50 && Game.shards == 5:
|
||||
Game.score += 250
|
||||
Game.shards_collected[5] = true
|
||||
#Time bonus
|
||||
if Game.golds == 50 && Game.shards == 5:
|
||||
if Game.time < map.target_time_100:
|
||||
Game.score += floor(2500 * (Game.time / map.target_time_100))
|
||||
Game.shards_collected[6] = true
|
||||
else:
|
||||
if Game.time < map.target_time_any:
|
||||
Game.score += floor(2500 * (Game.time / map.target_time_any))
|
||||
Game.shards_collected[6] = true
|
||||
#Life bonus
|
||||
if Game.lives == 1: Game.score += 500
|
||||
if Game.lives == 2:
|
||||
Game.score += 1500
|
||||
Game.shards_collected[7] = true
|
||||
#Perfect bonus
|
||||
if Game.lives == 2 && Game.golds == 50 && Game.shards == 5 && Game.time < map.target_time_100:
|
||||
Game.score += 1000
|
||||
Game.save()
|
||||
Game.change_map(load("res://maps/level_select.tscn"))
|
Loading…
Add table
Add a link
Reference in a new issue