🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Cripes! update: movement and the gameview

Published June 05, 2008
Advertisement
So far so good, I guess. I've got a skeleton GameView class, although at the moment all it does is store a buffer in memory, store the size of the buffer, and store the size of the viewing window (that is, how much of the buffer will be seen on-screen).

On the subject of movement, I've taken the easy route for now and just used cout (and my color/position manipulators from a couple months ago) to draw a player sprite (in fact simply an "X") at the center of the map. Then, during the main loop, where I catch VK_ESCAPE to quit in the last code example I gave, I pass the vkey value to my HandleKeypress function, which changes the values in a "myposition" COORD depending on which arrow key I've hit.

Now, my problem with this was that I would move more than I wanted to allow per frame (that is, one square per frame). I managed to fix that (a boolean "moved", if true then no changing of myposition), but now my problem is a more difficult one: I want to be able to tap an arrow key and have it move once, but also hold it and let it move as long as I want, and let go and stop movement. The letting go is the issue here, because you only let go when you SEE that you're where you want to be, but by then the frame has begun and it's already captured your continually-held movement key. Once you've let go, it doesn't realize that, and so it moves you one past where you wanted, and THEN stops. A real pain, isn't it?

So, currently I'm working through that little hitch, and I'll update again when I've got that working.
Previous Entry About Me
Next Entry Movement
0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement