Difference between revisions of "love.joystickpressed"

m (1 revision: Importing from potato (again).)
m (Yeah ...)
 
(6 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 
 
Called when a joystick button is pressed.
 
Called when a joystick button is pressed.
 
== Function ==
 
== Function ==
 +
{{newin|[[0.9.0]]|090|type=variant}}
 +
=== Synopsis ===
 +
<source lang="lua">
 +
love.joystickpressed( joystick, button )
 +
</source>
 +
=== Arguments ===
 +
{{param|Joystick|joystick|The joystick object.}}
 +
{{param|number|button|The button number.}}
 +
=== Returns ===
 +
Nothing.
 +
 +
== Examples ==
 +
=== Use joystickpressed to map stimulate the jumping of a player ===
 +
<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 ==
 +
{{oldin|[[0.9.0]]|090|type=variant}}
 
=== Synopsis ===
 
=== Synopsis ===
 
<source lang="lua">
 
<source lang="lua">
Line 13: Line 43:
 
== See Also ==
 
== See Also ==
 
* [[parent::love]]
 
* [[parent::love]]
 +
* [[love.joystickreleased]]
 
[[Category:Callbacks]]
 
[[Category:Callbacks]]
 
{{#set:Description=Called when a joystick button is pressed.}}
 
{{#set:Description=Called when a joystick button is pressed.}}
 +
{{#set:Subcategory=Joystick}}
 +
{{#set:Since=000}}
 +
== Other Languages ==
 +
{{i18n|love.joystickpressed}}

Latest revision as of 18:10, 10 July 2018

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 joystickpressed to map stimulate the jumping of a player

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