summaryrefslogtreecommitdiff
path: root/demos/2d/shower_of_bullets/shower.gd
blob: 50c1109489adcd49b0f47b32f33f2dae357e0ccc (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

extends Node2D

# Member variables
var touching = 0

func _input(event):
	if (event.type == InputEvent.MOUSE_MOTION):
		get_node("player").set_pos(event.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)