Multi Keys for games (New Features)

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

Hi
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 (1171 days ago) @ M Santos

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


while true
if apressed() then
print "a";
else
print ".";
endif
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.

Jim.

RSS Feed of thread
powered by my little forum