0

I was wondering if anyone could aid me by telling me the code or an example of code, for making objects move when a user hits an arrow key or any key for that matter. I've been searching for days for a tutorial to aid me, but have come up with nothing. Thank you for your time.

3
Contributors
6
Replies
8
Views
12 Years
Discussion Span
Last Post by Real-tiner
0

MS QBasic has the info in the help file although ive not programmed in basic for a while you need to use ONKEY/KEY X = ON or something along those lines...

0

Yeah, I finally found a tutorial after a long while of searching, it showed how to make something preprogrammed moved around, but if you pressed ESC it would shutdown, so I figured out the code from that. Thanks anyways.

0

inkey$ = press$ (this I suppose may be unnecesarry, but meh)
LOOP UNTIL press$ = CHR$(27) ((Esc)) OR etc.

0

u can use that yes. Its not very powerful though. Have you got an example of the working movement code? i found out where my Basic files were -> all my progs were in an old HD that failed.... so i lost it all!!!!! might re-install it on XP and have a go again :)

0

BASICally, you have to "undraw" the object, and then draw it again at the new location.

One trick is to GET the background behind the object, then DRAW it.

Then to move the object, you PUT the background back, GET the background behind where the object moved to, and then DRAW the object again.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.