blob: bba84317649cb0eefe0f6efdbdc3e8b618b8f0a1 (
plain)
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
28
29
30
31
32
|
extends Node2D
# member variables here, example:
# var a=2
# var b="textvar"
var touching=0
func _input(ev):
if (ev.type==InputEvent.MOUSE_MOTION):
get_node("player").set_pos(ev.pos-Vector2(0,16))
func _on_player_body_enter_shape( body_id, body, body_shape, area_shape ):
touching+=1
if (touching==1):
get_node("player/sprite").set_frame(1)
func _on_player_body_exit_shape( body_id, body, body_shape, area_shape ):
touching-=1
if (touching==0):
get_node("player/sprite").set_frame(0)
func _ready():
set_process_input(true)
pass
|