Difference between revisions of "love.joystickpressed"

m
Line 11: Line 11:
 
=== Returns ===
 
=== Returns ===
 
Nothing.
 
Nothing.
 +
 +
== Examples ==
 +
=== Use getPosition to help draw a custom mouse image ===
 +
<source lang="lua">
 +
function love.joystickpressed(joystick,button)
 +
  player:jumping()
 +
end
 +
 +
--inside playerClass
 +
function player:jumping()
 +
  if joyStick:isGamepadDown('a') then
 +
        if self.jump then
 +
      self.speedY = self.jumpSpeed
 +
            self.jump = false
 +
    end
 +
    end
 +
end
 +
</source>
 +
 
== Function ==
 
== Function ==
 
{{oldin|[[0.9.0]]|090|type=variant}}
 
{{oldin|[[0.9.0]]|090|type=variant}}

Revision as of 16:52, 28 May 2014

Called when a joystick button is pressed.

Function

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

Synopsis

love.joystickpressed( joystick, button )

Arguments

Joystick joystick
The joystick object.
number button
The button number.

Returns

Nothing.

Examples

Use getPosition to help draw a custom mouse image

function love.joystickpressed(joystick,button)
   player:jumping()
end

--inside playerClass
function player:jumping()
   if joyStick:isGamepadDown('a') then
        if self.jump then
	       self.speedY = self.jumpSpeed
            self.jump = false
    	end
    end
end

Function

Removed in LÖVE 0.9.0
This variant is not supported in that and later versions.

Synopsis

love.joystickpressed( joystick, button )

Arguments

number joystick
The joystick number.
number button
The button number.

Returns

Nothing.

See Also


Other Languages