Difference between revisions of "Tactile"
Line 1: | Line 1: | ||
− | |||
− | |||
− | |||
− | |||
'''Tactile''' is a flexible and straightforward input library for LÖVE to help you manage multiple input sources. Get the code on [https://github.com/tesselode/tactile GitHub]. | '''Tactile''' is a flexible and straightforward input library for LÖVE to help you manage multiple input sources. Get the code on [https://github.com/tesselode/tactile GitHub]. | ||
Line 37: | Line 33: | ||
end | end | ||
</source> | </source> | ||
+ | |||
+ | [[Category:Libraries]] | ||
+ | {{#set:LOVE Version=0.9.2}} | ||
+ | {{#set:Description=A flexible and nice input library.}} |
Revision as of 02:39, 20 July 2015
Tactile is a flexible and straightforward input library for LÖVE to help you manage multiple input sources. Get the code on GitHub.
function love.load()
tactile = require 'tactile'
--button detectors
keyboardLeft = tactile.key('left')
keyboardRight = tactile.key('right')
keyboardX = tactile.key('x')
gamepadA = tactile.gamepadButton('a', 1) --the second argument is controller number, in case you're wondering
--axis detectors
keyboardXAxis = tactile.binaryAxis(keyboardLeft, keyboardRight)
gamepadXAxis = tactile.analogStick('leftx', 1)
--controls
horizontal = tactile.addAxis(keyboardXAxis, gamepadXAxis)
shoot = tactile.addButton(keyboardX, gamepadA)
end
function love.update(dt)
--you have to update buttons, sorry for the extra step :(
shoot:update()
--movement
player.x = player.x + player.speed * horizontal:getValue() * dt
--shooting
if shoot:pressed() then
player:shoot()
end
end