multiple updates
This commit is contained in:
1 parent
d265ef4598
commit
246bdf0e98
18 files changed
+76
-58
No files matched your search
@@ -2,7 +2,7 @@ extends CharacterBody2D
|
||||
|
||||
|
||||
const SPEED = 300.0
|
||||
const JUMP_VELOCITY = -300.0
|
||||
const JUMP_VELOCITY = -500.0
|
||||
const PUSH_FORCE = 50
|
||||
|
||||
# Get the gravity from the project settings to be synced with RigidBody nodes.
|
||||
|
||||
@@ -1,15 +1,31 @@
|
||||
extends Node2D
|
||||
|
||||
var totalCrates = 2
|
||||
var cratesCollected = 0
|
||||
var timeLimit = 10
|
||||
var timer:= Timer.new()
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
pass # Replace with function body.
|
||||
add_child(timer)
|
||||
timer.wait_time = 1
|
||||
timer.one_shot = false
|
||||
timer.connect("timeout", secondCounter)
|
||||
timer.start()
|
||||
|
||||
func secondCounter():
|
||||
timeLimit -= 1
|
||||
if timeLimit <=0:
|
||||
print("You lose baby!")
|
||||
get_tree().reload_current_scene()
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
pass
|
||||
|
||||
|
||||
func _on_area_2d_areatrigger(effect, Object):
|
||||
func _on_area_2d_areatrigger(effect, body):
|
||||
print("Game Controller sees the trigger")
|
||||
if body is RigidBody2D:
|
||||
print("a crate entered trigger")
|
||||
cratesCollected +=1
|
||||
body.queue_free()
|
||||
if cratesCollected>=totalCrates:
|
||||
print("You win baby!")
|
||||
get_tree().reload_current_scene()
|
||||
Reference in new issue
Block a user