Difference between revisions of "love.joystickpressed"
(Added new 0.9.0 version) |
m (Yeah ...) |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 11: | Line 11: | ||
=== Returns === | === Returns === | ||
Nothing. | 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 == | == Function == | ||
{{oldin|[[0.9.0]]|090|type=variant}} | {{oldin|[[0.9.0]]|090|type=variant}} | ||
Line 24: | 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}} | {{#set:Since=000}} | ||
== Other Languages == | == Other Languages == | ||
{{i18n|love.joystickpressed}} | {{i18n|love.joystickpressed}} |
Latest revision as of 16:10, 10 July 2018
Called when a joystick button is pressed.
Contents
Function
Available since LÖVE 0.9.0 |
This variant is not supported in earlier versions. |
Synopsis
love.joystickpressed( joystick, button )
Arguments
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
Returns
Nothing.
See Also
Other Languages
Dansk –
Deutsch –
English –
Español –
Français –
Indonesia –
Italiano –
Lietuviškai –
Magyar –
Nederlands –
Polski –
Português –
Română –
Slovenský –
Suomi –
Svenska –
Türkçe –
Česky –
Ελληνικά –
Български –
Русский –
Српски –
Українська –
עברית –
ไทย –
日本語 –
正體中文 –
简体中文 –
Tiếng Việt –
한국어
More info