add dramatic tension
This commit is contained in:
parent
2605a085e2
commit
90bdd35020
@ -45,7 +45,7 @@ position = Vector2(629, 37)
|
||||
[node name="CharacterBody2D" type="CharacterBody2D" parent="."]
|
||||
position = Vector2(524, 393)
|
||||
script = ExtResource("2_uc4yi")
|
||||
PUSH_FORCE = 50
|
||||
PUSH_FORCE = 100
|
||||
metadata/_edit_group_ = true
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="CharacterBody2D"]
|
||||
|
@ -1,17 +1,38 @@
|
||||
extends Node2D
|
||||
|
||||
var boxTotal = 4
|
||||
var timer:= Timer.new()
|
||||
@export var secondCount= 15
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
pass # Replace with function body.
|
||||
add_child(timer)
|
||||
timer.wait_time = 1
|
||||
timer.one_shot = false
|
||||
timer.connect("timeout", secondCounter)
|
||||
timer.start()
|
||||
|
||||
func secondCounter():
|
||||
print("time left: ", secondCount)
|
||||
secondCount -=1
|
||||
if secondCount <= 0:
|
||||
print("A loser is you")
|
||||
get_tree().reload_current_scene()
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
||||
|
||||
func _on_trigger(effect: Variant, body) -> void:
|
||||
print("they were triggered!")
|
||||
if body is RigidBody2D:
|
||||
if body is RigidBody2D:
|
||||
print("crate spotted")
|
||||
boxTotal -= 1
|
||||
body.queue_free()
|
||||
if boxTotal <=0:
|
||||
print("A winner is you")
|
||||
get_tree().reload_current_scene()
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user