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