Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help on key hits.
#1
Ok. Lets say that I already know how to control a player by using the inkey$ function and this was back when I was making text mode games.

And now I want to move the player when I hold down either an arrow key or the letter keys and not just tapping it.

Inkey$ doesn't do it right. Inkey$ a thing where a player simply taps the key and the character moves one direction. I understand that if you hold it down, the character moves one direction at first but after a half second delay, the player starts moving.

So anyways, how hard would this be?
Reply
#2
very very easy =) theres a thing called multikey()

you use the scancode of the key to trap

for instance, enter is scancode &H1C (i think), so in order to see if the user pressed enter you could do


Code:
if multikey(&h1C) then do_stuff


and to make things even Easier, theres a .bi file in \inc that has a file called 'fbgfx.bi'. include that iin your progs, and multikey becomes as easy as


if multikey(sc_enter) then do_stuff
Reply
#3
Careful - that'll only work in graphics mode using the built-in gfxlib - i.e. after SCREEN has been called.
Reply
#4
yes definitely noteworthy...


(spam post hehe i passed your post count drv) :rotfl:

im done
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)