Vore_Sandbox_Remaster/scripts/CamCursor.gd

38 lines
1.1 KiB
GDScript3

extends Camera2D
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
var cursor = true #if ture, moving moves cursor. otherwise moving moves cam
var mouse = true #if true, moves to mouse otherwise moves with KB or joystick
var curnode = null
export var display = "Untitled Cam"
const DRAGM = 0.7
# Called when the node enters the scene tree for the first time.
func _ready():
curnode = get_node_or_null("cur")
if curnode != null:
print("tsetsetse tsets ets etsts ethere is cursor")
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
if current:
if mouse:
position = get_global_mouse_position()
#$cur.visible = cursor
drag_margin_h_enabled = cursor
drag_margin_v_enabled = cursor
if cursor:
anchor_mode = Camera2D.ANCHOR_MODE_DRAG_CENTER
else:
anchor_mode = Camera2D.ANCHOR_MODE_FIXED_TOP_LEFT
position.x = clamp(position.x,limit_left,limit_right-1)
position.y = clamp(position.y,limit_top,limit_bottom-1)
func _unhandled_input(event):
if event is InputEventMouseButton and event.is_pressed():
cursor = true