How to make 2 things happen at once in Qbasic

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Post Reply
tibbalz
Newbie
Posts: 1
Joined: Fri Nov 09, 2007 1:00 pm

How to make 2 things happen at once in Qbasic

Post by tibbalz »

I'm pretty decent in Qbasic but I still cannot figure out how to make Qbasic do two things at one like

Code: Select all

locate row, column
print player$
while it does this at the same time

Code: Select all

locate row, column
print badguy$
I wish I could explain myself a little better
BDZ
Coder
Posts: 49
Joined: Sun Nov 20, 2005 5:41 pm
Location: Wisconsin
Contact:

Post by BDZ »

Except for some strange sound functions and event-trapping stuff, you cannot have QB "do two things at once." I guess the question I have is why do you need to have it print two things exactly at the same time? Just print one after the other. To the user this will appear instantaneous.
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Post by burger2227 »

Loops are pretty fast, so you can make it appear to be doing two things at once. The only problem is if a procedure in the loop creates a delay of some kind.

To print both the player and badguy you can print them both in a loop, but you will also have to find the new column and row too. This could be set as a reaction to a players move for instance in an arrow key move, etc.

Ted
Mac
Veteran
Posts: 151
Joined: Mon Aug 06, 2007 2:00 pm

Re: How to make 2 things happen at once in Qbasic

Post by Mac »

[quote="tibbalz"]I wish I could explain myself a little better[/quote]

Well, I think you need to try harder.

Explain what problem you are trying to solve.

What kind of game are you working on?

Mac
Nodtveidt
Veteran
Posts: 826
Joined: Sun Jul 25, 2004 4:24 am
Location: Quebradillas, PR
Contact:

Post by Nodtveidt »

As BDZ stated, just execute them one after the other. They will work so quickly that the player won't even notice that they're not being updated at exactly the same moment in time.
Mac
Veteran
Posts: 151
Joined: Mon Aug 06, 2007 2:00 pm

Re: How to make 2 things happen at once in Qbasic

Post by Mac »

[quote="tibbalz"] how to make Qbasic do two things at once[/quote]

Well, your print example was strange, but here is a simple example of moving two missiles at once while prompting the user for input:

http://www.network54.com/Forum/171757/m ... 009940081/

Mac
Post Reply