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.

Recommended Answers

All 6 Replies

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...

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.

might be a good idea to post a snippet then if it works :)

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

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 :)

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.