blob: fcc878e565ac8529444b19a24a1f6bc4c7ef8ea5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
extends Node2D
# Member variables
const CAVE_LIMIT = 1000
func _input(event):
if (event.type == InputEvent.MOUSE_MOTION and event.button_mask&1):
var rel_x = event.relative_x
var cavepos = get_node("cave").get_pos()
cavepos.x += rel_x
if (cavepos.x < -CAVE_LIMIT):
cavepos.x = -CAVE_LIMIT
elif (cavepos.x > 0):
cavepos.x = 0
get_node("cave").set_pos(cavepos)
func _ready():
set_process_input(true)
|