• Welcome to Dark Bit Factory & Gravity.
 

Inkey$

Started by DrewPee, August 28, 2006

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

DrewPee

Hello guys,
Just a small one here . . . ive written some code that uses the code that MrP did - the Inline ASM bit!
I have used it to draw a graphic on the screen and i want to be able to move it left and right using Z for left and X for right . . .
Ive tried using inkey$ but it only seems to pick up one key! Don't know if im making myself clear, i will attach the code.
basically i want to move my graphic left and right using keys and it dont work at the mo . . .
Please help

Regards
DrewPee
DrewPee
aka Falcon of The Lost Boyz (Amiga)
Ex-Amiga Coder and Graphic Designer
Administrator of > www.retrocomputermuseum.co.uk

Clyde

Here you go mate this is kind of how I do things with key input except I use Chr(num). This should be easier enough to follow, and hope it's of some use to you matey.


Dim Key As String
Dim Running=0

While Running<>1
   
    for y = 0 to 7
        for x = 0 to 15
            if cannon(tot)=1 then col=255 else col=0
            put_pixel(acx+x, 466+y, rgb(0, col,0))
            tot=tot+1
            locate 2,2:print key
       
        next x
    next y

    tot=0
    screensync
    flip
   
    if key="Z" or Key="z" then acx=acx-3
    if key="X" or Key="x" then acx=acx+3
    if key="Q" or Key="q" then Running=1
   
    Key=Inkey() 'Flush / Empty keybuffer
   
Wend

end


Cheers,
Clyde.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.


Challenge Trophies Won:

DrewPee

Thanks for that Clyde, very much appreciated - works like a dream.

Regards
DrewPee
DrewPee
aka Falcon of The Lost Boyz (Amiga)
Ex-Amiga Coder and Graphic Designer
Administrator of > www.retrocomputermuseum.co.uk

Clyde

No probs dude :)

All the best with your creations bud,
Clyde.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.


Challenge Trophies Won: