-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCandle.gd
27 lines (22 loc) · 849 Bytes
/
Candle.gd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
extends "res://Scripts/Grabbable.gd"
# Called when the node enters the scene tree for the first time.
func _ready():
pass
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
if GlobalVars.player.heldItem == self:
$GrabPoint.set_collision_layer(0)
else:
$GrabPoint.set_collision_layer(1)
if GlobalVars.grabItem == self:
$Sprite.material.set_shader_param("active", true)
else:
$Sprite.material.set_shader_param("active", false)
if position.x > (GlobalVars.levelSize.x/2):
position.x = (GlobalVars.levelSize.x/2)
elif position.x < (-GlobalVars.levelSize.x/2):
position.x = -(GlobalVars.levelSize.x/2)
if position.y > (GlobalVars.levelSize.y/2):
position.y = (GlobalVars.levelSize.y/2)
elif position.y < (-GlobalVars.levelSize.y/2):
position.y = -(GlobalVars.levelSize.y/2)