2015-03-16 04:47:37 +01:00
|
|
|
|
|
|
|
extends Node2D
|
|
|
|
|
2015-11-21 16:13:43 +01:00
|
|
|
# Member variables
|
|
|
|
const CAVE_LIMIT = 1000
|
2015-03-16 04:47:37 +01:00
|
|
|
|
2015-11-21 16:13:43 +01:00
|
|
|
|
|
|
|
func _input(event):
|
|
|
|
if (event.type == InputEvent.MOUSE_MOTION and event.button_mask&1):
|
|
|
|
var rel_x = event.relative_x
|
2015-03-16 04:47:37 +01:00
|
|
|
var cavepos = get_node("cave").get_pos()
|
2015-11-21 16:13:43 +01:00
|
|
|
cavepos.x += rel_x
|
|
|
|
if (cavepos.x < -CAVE_LIMIT):
|
|
|
|
cavepos.x = -CAVE_LIMIT
|
|
|
|
elif (cavepos.x > 0):
|
|
|
|
cavepos.x = 0
|
2015-03-16 04:47:37 +01:00
|
|
|
get_node("cave").set_pos(cavepos)
|
2015-11-21 16:13:43 +01:00
|
|
|
|
2015-03-16 04:47:37 +01:00
|
|
|
|
|
|
|
func _ready():
|
2015-11-21 16:13:43 +01:00
|
|
|
set_process_input(true)
|