0 votes

Hello everyone,

i followed this tutorial to create an in-game inventory, Diablo style:

Everything works perfectly, and except few adjust i made so the object are usefull, i basically copy pasted the code. I added it in the zip file. Feel free to take a look, or simply grab it for yourself.

My problem: i don't manage to use a controller to use this inventory.

What i did: I modified the main code so the cursor doesn't react to the mouse position but to be piloted by the right game joystick.

What happen: beside the fact that i had to modify the code so the modified cursor returned a global position, when i let go of an object, it is stuck in place, without taking care of the structure working with the mouse. Even wort: i can't move the thing at all at this point.

The modification is the following

    func _process(delta):
         var xAxisRL = Input.get_joy_axis(0, JOY_AXIS_2)
         var yAxisUD = Input.get_joy_axis(0 ,JOY_AXIS_3)
         var JOYPAD_SENSITIVITY = 20
         $CurseurManette.position += Vector2(xAxisRL,yAxisUD) * 20
         var cursor_pos = $CurseurManette.position + self.rect_position +   get_node("../").position


    func _process(delta):
           var cursor_pos = get_global_mouse_position()

I will keep looking on my side, but i figured getting an external POV might help.
Sheer, and thank for your time!


Godot version 3.0
in Engine by (16 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.