HI guys ! I'm actually tidying up my code since there's not much to do until the demo's ready (replacing everything in static type, finishing little things like this lmb event button..)
And I've hit a wall. No matter what I try, it's impossible for me to make this lmb event works. It only freeze, and fails to do so.
Here's the code used :
var showed:bool = false
var click = InputEventMouseButton.new()
func _ready() -> void:
func _physics_process(delta) -> void:
if showed == true and GameData.controller == true:
mouse_pos -= (Vector2(Input.get_action_strength("joy_left") - Input.get_action_strength("joy_right"), Input.get_action_strength("joy_up") - Input.get_action_strength("joy_down"))) * 7
click.position = mouse_pos
func _input(_event) -> void:
if Input.is_action_just_pressed("l1") and showed == true:
showed = false
if GameData.controller == true:
func _hold_left_click() -> void:
click.pressed = true
#click.pressed = false
Here's the goal : I want my player to be able to move the mouse when the inventory is showed (which works using the "getactionstrength") and then be able to drag and drop the textures of the inventory.
I'm using the inner function of control nodes to do that (getdragdata(), candropdata(), drop_data()), which should work fine since it works by a lmb event button when using the mouse.
I tried, just in case, to see if the control node had detected the mouse coming from using the controller as a... mouse doing a print on the event "mouse_entered", and yes, it does. Better safe than sorry.
Back to the problem : If I try to emulate my left_click using the "cross" button of the controller, here's what the output says :
Failed method: Control:holdleft_click target ID: 1619
TOTAL BYTES: 4194288
NULL count: 0
CALL : 174761
CALL holdleft_click: 1
Can't really understand this one, didn't get it once before. I just understand that it fails to call the method asked by call_deferred().
How does it works ? Is it impossible to emulate a holded lmb to drag and drop the textures of my inventory ?
Am I dumb and unable to see what's the problem even though it's a simple one ?
I'm thankful for your help, it's been 3 days and I can't keep hitting that wall forever.