• Please review our updated Terms and Rules here

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

Robuck

Experienced Member
Joined
Jul 30, 2017
Messages
65
Location
Philadelphia PA
Hello,

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.

Thanks,
Mark Robuck
 
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!
 
Back
Top