Multi Keys for games (New Features)

by M Santos, Friday, January 10, 2014, 10:53 (1261 days ago)

Is it possible to have a function that returns true if a specified key is being pressed?
That is useful for games.

Multi Keys for games

by Jim ⌂ @, Russell, KY, Friday, January 10, 2014, 14:17 (1261 days ago) @ M Santos

function apressed()
return key = asc("A")
end function

while true
if apressed() then
print "a";
print ".";
end while

The problem with the code is the a will only be true once for each key press or key repeat on your keyboard. The key statement pulls the current key code and then resets until the next key is pressed.


RSS Feed of thread
powered by my little forum