summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorJan Tuomi <jan.tuomi@valuemotive.com>2020-07-30 12:03:19 +0300
committerJan Tuomi <jan.tuomi@valuemotive.com>2020-07-30 12:03:19 +0300
commitd07037aa7ffb18b3219f1a73b1d8ef8b04be915c (patch)
treebfd50d39fda84a89bc9b7f0c0022c61297928857 /scripts
parentfcfc2f9df77c4e7d10eea6a9dee10f0d13288f9c (diff)
Add ladder logic
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Ladder.gd20
-rw-r--r--scripts/PlayerCharacter.gd4
2 files changed, 24 insertions, 0 deletions
diff --git a/scripts/Ladder.gd b/scripts/Ladder.gd
new file mode 100644
index 0000000..ea4265d
--- /dev/null
+++ b/scripts/Ladder.gd
@@ -0,0 +1,20 @@
+extends Area2D
+
+
+# Declare member variables here. Examples:
+# var a = 2
+# var b = "text"
+
+
+# Called when the node enters the scene tree for the first time.
+func _ready():
+ pass # Replace with function body.
+
+
+# Called every frame. 'delta' is the elapsed time since the previous frame.
+#func _process(delta):
+# pass
+
+func _on_Ladder_body_entered(body):
+ if body is PlayerCharacter:
+ body.change_level()
diff --git a/scripts/PlayerCharacter.gd b/scripts/PlayerCharacter.gd
index 9f52a23..edcbdb2 100644
--- a/scripts/PlayerCharacter.gd
+++ b/scripts/PlayerCharacter.gd
@@ -1,4 +1,5 @@
extends KinematicBody2D
+class_name PlayerCharacter
export (int) var speed = 8
export (float) var walk_wobble_coeff = 5
@@ -39,3 +40,6 @@ func _process(_delta):
func _physics_process(_delta):
get_input()
velocity = move_and_slide(velocity)
+
+func change_level():
+ print("change_level()")