Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Using the up,down,left,and right arrow keys

I am trying to make a game that you are CHR$(1) (the symbol of the pac man guy) and you chase the other guy CHR$(2) around the screen.I was just wondering how would i use the arrow keys and have the character CHR$(1) under your control.Do you know what i'm talking about???Please help me!


Comments



  • : I am trying to make a game that you are CHR$(1) (the symbol of the pac man guy) and you chase the other guy CHR$(2) around the screen.I was just wondering how would i use the arrow keys and have the character CHR$(1) under your control.Do you know what i'm talking about???Please help me!


    Send me your e-mail. I think I can make a file that points out this technic.


  • : I am trying to make a game that you are CHR$(1) (the symbol of the pac man guy) and you chase the other guy CHR$(2) around the screen.I was just wondering how would i use the arrow keys and have the character CHR$(1) under your control.Do you know what i'm talking about???Please help me!


    To use the arrow keys U use the INKEY$ command

    as usual, like this:

    x$ = inkey$

    if x$ """ then

    if x$ = "a" then do something!

    if x$ = chr$(0) + "H" then UP

    if x$ = chr$(0) + "P" then DOWN

    if x$ = chr$(0) + "K" then LEFT

    if x$ = chr$(0) + "M" then RIGHT

    end if


    got it? U use the CHR$(0) in front.

    To see the codes for other keys use this:

    'Start

    do

    x$ = inkey$

    if x$ "" then

    locate 1,1

    print x$

    end if

    loop while x$ chr$(27) 'Pressed ESC.

    'End code.


    When U press the UP key U will see a blank char

    followed by an "H", and so on.


    Hope I was useful!


Sign In or Register to comment.