I want to make a game where you use "a" and "d" to move a dot from left to right. The game play would be like this, printing lines in console:
...o....
...o....
...o.... ("a" pressed)
..o..... ("a" held)
.o...... ("a" released)
.o......
.o......
..o..... ("d" pressed)
...o.... ("d" held)
....o... ("d" released)
could somebody please give me the code to do this. I'm currently running mac OS X. Thanks a google.
so by you want to make a game you mean you want us to write a game for you for free on our own time and give you the code so you can take full credit and benefits from it...?
I'm still new to programming but is it even possible to do something like that in console?? I could see how that would be a pretty simple and easy windows program. But can you update console applications in real time by pressing a key??
I know you can press a key and record the input after you press 'enter' but that's about it. I'm actually curious to know if this is possible in console, so I know how to do it for future reference. Goodluck with your program and let us know if you figure it out.
I'm actually just trying to write code for allowing key input during a while loop. This was supposed to be in console, so the code can revolve almost entirely around:
int pos;
while("q not pressed")
{
if ("a button active")
{ pos--; }
if ("w button active")
{ pos++; }
cout << line of dots with O at pos
}
I could use cin, but you wouldn't be able to press and hold. And I could use cin.getline(), but I want something that works for all buttons. Also, @ascii, I'm simplifying the project to revolve around where I need help. Try not to associate yourself with being an ass, it's bad for your ego.
You need an GUI like alleggro to do something like this. Normal console wasn't created to support user input like this. The console without special libraries always waits for input to be "Entered" so you should read up on alleggro.
Oooh bummer. I was hoping it might be something easy like... is key pressed("whatever key"). I'm probably going to have to take a class before I can finish this project. Thanks anyways... here's a cool website http://www.1x.com/photos.