2014-11-06 01:20:42 +01:00
|
|
|
|
|
|
|
extends Node2D
|
|
|
|
|
2015-11-21 16:13:43 +01:00
|
|
|
# Member variables
|
|
|
|
var touching = 0
|
2014-11-06 01:20:42 +01:00
|
|
|
|
2015-11-21 16:13:43 +01:00
|
|
|
func _input(event):
|
|
|
|
if (event.type == InputEvent.MOUSE_MOTION):
|
|
|
|
get_node("player").set_pos(event.pos - Vector2(0, 16))
|
2014-11-06 01:20:42 +01:00
|
|
|
|
|
|
|
|
2015-11-21 16:13:43 +01:00
|
|
|
func _on_player_body_enter_shape(body_id, body, body_shape, area_shape):
|
|
|
|
touching += 1
|
|
|
|
if (touching == 1):
|
2014-11-06 01:20:42 +01:00
|
|
|
get_node("player/sprite").set_frame(1)
|
|
|
|
|
|
|
|
|
2015-11-21 16:13:43 +01:00
|
|
|
func _on_player_body_exit_shape(body_id, body, body_shape, area_shape):
|
|
|
|
touching -= 1
|
|
|
|
if (touching == 0):
|
2014-11-06 01:20:42 +01:00
|
|
|
get_node("player/sprite").set_frame(0)
|
|
|
|
|
|
|
|
|
|
|
|
func _ready():
|
2015-11-21 16:13:43 +01:00
|
|
|
# Initialization here
|
2014-11-06 01:20:42 +01:00
|
|
|
set_process_input(true)
|