This commit is contained in:
2026-01-21 23:40:20 +01:00
commit d1f8068081
478 changed files with 24902 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
extends Area2D
class_name MouseInteractionComponent
@export var stickyHold: bool = false #When this is true the action can be held even tho the mouse has allready left the area
var mouseInside: bool = false #When mouse is inside collision
var mousePressedL: bool = false #When Left mouse button is pressed down
var actionHeld: bool = false
signal actionPressed
func _input(event: InputEvent) -> void:
if event.is_action_pressed("MinigameClick"):
mousePressedL = true
if event.is_action_released("MinigameClick"):
mousePressedL = false
func _process(_delta: float) -> void:
if mousePressedL and (mouseInside or (stickyHold and actionHeld)):
if !actionHeld:
actionPressed.emit()
actionHeld = true
else:
actionHeld = false
func _mouse_enter() -> void:
mouseInside = true
func _mouse_exit() -> void:
mouseInside = false