Need help with Collision Detection in QBasic
I have the ASCII code for a "Happy Face" symbol that moves around the screen via input from the keyboard''s arrow keys. However, when he gets to the end of the screen, he disappears but you can bring him back via the corresponding arrow key! (sorry if i lost you yet!) How would I code the collision detection so that he won''t go off the screen? Incase it might help, i''m running my 15in. monitor on 1024x768 and the color is 16bpp.
Unless you''re using QB4.5 with an svga library attached using the command line option then you are not running in 1024x768 mode in QBasic, you are running in text mode (80x25).
What you need to do is boundary checking, such as
What you need to do is boundary checking, such as
Replace this...If Key=Right then X=X+1...with this...If Key=Right AND X<80 then X=X+1 ''Checks to ensure you are not at the edge of the screen
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement