Image Map Image Map
Results 1 to 5 of 5

Thread: QBasic: reading what character is displayed at a point on the screen?

  1. #1

    Default QBasic: reading what character is displayed at a point on the screen?


    I don’t know how well I can explain this, but I will try. I am fairly new to programming, and I’m making a small text graphics roguelike game. So far I have the movement and stuff set up, but my biggest hurdle is collisions. I had the idea to log the players position into a “memory” variable, so that whenever the player is in a spot he shouldn’t be, it sets is position to the one in memory. This works great! But it is very tedious to write out an if command to check if the player is colliding with something for almost every space that I need. My idea is to just draw out the map, and check if the spot the player is about to jump to is a wall, and of course send him back if it is. Basically I need a command that can check what character is at a specific point, using the text coordinate system. Is this something that is possible? What command should I use? Any info or advice would be appreciated.

    Mark Robuck

  2. #2


    Looks like the GET statement is the one.

  3. Default

    Quote Originally Posted by Robbbert View Post
    Looks like the GET statement is the one.
    GET & PUT are for graphics. The function to use is called SCREEN (different from the statement with the same name):

    IF SCREEN(newY,newX) = ASC(".") THEN
        playerY = newY
        playerX = newX
    END IF

  4. #4


    your going about it the wrong way. Whats on screen is irrelevant. You want an (oh this is qbasic right?) an 2d array of your map and you lookup your map to see if its index is void/wall/floor/door etc. Once you check they can make a legal move, you then check your array of NPC's and see if the destination x.y is matchin an NPC and BUMP FIGHT!

  5. #5


    This worked perfectly!!! Thank you so much


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts