21 lines
477 B
GDScript
21 lines
477 B
GDScript
extends Node2D
|
|
|
|
class_name Item
|
|
|
|
var shape : Array[Array]
|
|
var inventory_position : Vector2i
|
|
|
|
var draggable = true
|
|
|
|
var dragging = false
|
|
|
|
var mouse_offset : Vector2
|
|
|
|
func _process(delta: float) -> void:
|
|
if dragging:
|
|
global_position = get_global_mouse_position() + mouse_offset
|
|
|
|
if Input.is_mouse_button_pressed(MOUSE_BUTTON_LEFT):
|
|
var mouse_difference = get_global_mouse_position() - position
|
|
if mouse_difference.x > 0 and mouse_difference.y > 0 and mouse_difference.x:
|