player.tscn: scholar of the first bullet casings
This commit is contained in:
parent
79cbd62a69
commit
bc57ba4171
45 changed files with 1429 additions and 113 deletions
|
@ -36,7 +36,7 @@ func _physics_process(delta):
|
|||
if Input.is_action_pressed("debug_move_player"):
|
||||
var nodes = get_tree().get_nodes_in_group("player")
|
||||
if not nodes.empty():
|
||||
var player = nodes[0].get_parent()
|
||||
var player = nodes[0]
|
||||
var mouse_position = SceneManager.viewport.get_mouse_position() / SceneManager.viewport_container.rect_scale
|
||||
mouse_position.x = clamp(mouse_position.x, 8.0, Game.resolution.x - 8.0)
|
||||
mouse_position.y = clamp(mouse_position.y, 8.0, Game.resolution.y - 8.0)
|
||||
|
|
|
@ -126,3 +126,26 @@ func freeze_frame(time):
|
|||
#Check if 100%ed
|
||||
func has_collection_bonus():
|
||||
return shards == 5 && golds == 50
|
||||
|
||||
# called when player dies
|
||||
func _on_player_died() -> void:
|
||||
if lives <= 0 and use_lives:
|
||||
Audio.play_sound(Audio.a_gover, Audio.ac_die)
|
||||
get_tree().get_nodes_in_group("player")[0].queue_free()
|
||||
var time_tween = create_tween()
|
||||
time_tween.tween_property(Engine, "time_scale", 0.1, 0.3)
|
||||
Audio.ac_music.stream_paused = true
|
||||
yield(time_tween, "finished")
|
||||
yield(get_tree().create_timer(1.0 * 0.1), "timeout")
|
||||
call_deferred("restart_level")
|
||||
else:
|
||||
# count death
|
||||
lives -= 1
|
||||
deaths += 1
|
||||
# play death sound
|
||||
Audio.play_sound(Audio.a_die, Audio.ac_die)
|
||||
# death score penalty
|
||||
if use_lives == false && lives < 0:
|
||||
score = max(0, score - 500)
|
||||
# freezeframe
|
||||
Game.freeze_frame(0.3)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue