add dramatic tension

This commit is contained in:
Kevin (O) Gorman 2025-01-06 20:51:49 -05:00
parent 2605a085e2
commit 90bdd35020
2 changed files with 24 additions and 3 deletions

View File

@ -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"]

View File

@ -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()