Difference between revisions of "love.joystickaxis"

m
(Returns)
Line 12: Line 12:
 
=== Returns ===
 
=== Returns ===
 
Nothing.
 
Nothing.
 +
 +
=== Example ===
 +
<source lang="Lua">
 +
function love.joystickaxis( joystick, axis, value )
 +
if axis == 1 then
 +
position.x = position.x + 1/60*speed * value
 +
elseif axis == 2 then
 +
position.y = position.y + 1/60*speed * value
 +
end
 +
end
 +
</source>
 +
 
== See Also ==
 
== See Also ==
 
* [[parent::love]]
 
* [[parent::love]]

Revision as of 12:57, 4 November 2021

Available since LÖVE 0.9.0
This callback is not supported in earlier versions.

Called when a joystick axis moves.

Function

Synopsis

love.joystickaxis( joystick, axis, value )

Arguments

Joystick joystick
The joystick object.
number axis
The axis number.
number value
The new axis value.

Returns

Nothing.

Example

function love.joystickaxis( joystick, axis, value )
	if axis == 1 then
		position.x = position.x + 1/60*speed * value
	elseif axis == 2 then
		position.y = position.y + 1/60*speed * value
	end
end

See Also


Other Languages