Hello All,
I was wondering if there was any way to get the axis of the right analogue stick on an Xbox 360 control using love2d's Joystick function?
I was thinking of using it for a aiming stick in a rogue like style game.
Thanks for any help you can provide.
The Right Analogue Stick
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- StormtrooperCat
- Prole
- Posts: 11
- Joined: Fri Mar 09, 2018 12:29 am
- Contact:
Re: The Right Analogue Stick
Here's my code for accessing the analog sticks.
Inside love.load:
Inside love.update:
Inside love.load:
Code: Select all
-- Get any attached joysticks (aka gamepads) - assume final joystick found is player 1 for now
local joysticks_found = love.joystick.getJoysticks()
for i, joy in ipairs(joysticks_found) do
player_1_joystick = joy
end
Code: Select all
-- Left analog
left_analog_vector_x = player_1_joystick:getAxis(1)
left_analog_vector_y = player_1_joystick:getAxis(2)
-- Right analog
right_analog_vector_x = player_1_joystick:getAxis(3)
right_analog_vector_y = player_1_joystick:getAxis(4)
Who is online
Users browsing this forum: Bing [Bot], steVeRoll and 4 guests