troubleshooting Question

Console Based Game - Reading the keyboard without pausing

Avatar of meerkat2040
meerkat2040 asked on
C++
8 Comments1 Solution316 ViewsLast Modified:
I'm taking an intro to c++ class.  My assignment is to create a console based game.

I would like a section of the code to check to see what the last key pressed was (arrow keys), and scroll the screen in that direction continuously until another direction is pressed.  I'm doing a maze that keeps moving all the time, where you have to avoid hitting the walls but can never stand still.

getch() doesn't work for me because it pauses the movement of the game while waiting for input.  I would prefer just to scan the keyboard for the last key pressed before another key is entered.
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 8 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros