Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Two mouse related questions
#1
I'm making a game involving a mouse and a box. Player one is the mouse and player two is the box, and the object is for the mouse to click on the box while the box moves around the screen. The object is for the mouse to click on the box, but it goes more into detail. The problem is, player 1 can always hold down the mouse and bx = 1. This way the player won't have to click on the box, but just move around the screen with the mouse button down. I tried to make a function only allows the mousebx to be equal to 1 for only one second, but I failed to do this. So, my question is, does anybody have a simpel command involving little or no ASM so that bx can only be equal to 1 for 1 second?

My second question is if there are any compilers that can convert a Qbasic 1.0 bas file to an exe. In QB 1.0, there is no RUN>>>MAKE EXE FILE option, so I wonder if there was a way to do this. I believe I saw that there was a compiler for this on another site. The reason why I am running it in QB 1.0, is because I am using Vic's mouse code which requires the first qbasic. unless if use the /l in the qb45 command line, but there's an error while trying to compile files.

Smile :lol: Big Grin Thanks for help![/b]
quote="na_th_an"]
Greenday, Spice Girls... Can you tell the difference?
[/quote]
Reply
#2
The easiest way to detect a mouse click is to check if the mouse button is *not* currently pressed, but was pressed on the last check. This is how most GUIs, including Windows, define a "click". Your loop would look something like:

Code:
DO
  OldButton = CurrentButton
  CurrentButton = MouseStatus()  'varies depending on how you get mouse stats
  IF CurrentButton = FALSE AND OldButton = TRUE THEN
    PRINT "Clicked"
  END IF
LOOP

If you'd rather, you can reverse the check. This may suit your game better:

Code:
DO
  OldButton = CurrentButton
  CurrentButton = MouseStatus()  'varies depending on how you get mouse stats
  IF CurrentButton = TRUE AND OldButton = FALSE THEN
    PRINT "Clicked"
  END IF
LOOP

Answer to second question: QB 4.x, 7.x and VB DOS. If you're getting an error compiling with QB 4.5, you're probably missing QB.LIB. You can get it from here.
Reply
#3
Thanks Plasma

BTW, I do have that library you were talking about, and it runs fine, and compiles, it's just when I open the .exe it doesn't run.
quote="na_th_an"]
Greenday, Spice Girls... Can you tell the difference?
[/quote]
Reply
#4
Are you making a stand-alone exe?
Reply
#5
Hmmm? What's that?
quote="na_th_an"]
Greenday, Spice Girls... Can you tell the difference?
[/quote]
Reply
#6
Make sure you have full menus enabled (Options->Full Menus). Then when you go to Run -> Make EXE, make sure you choose Stand-Alone EXE File. Otherwise the EXE will require BRUN45.EXE to run, which you probably don't want.
Reply
#7
Oh, I'll try that then. Thank you for your help. Smile
quote="na_th_an"]
Greenday, Spice Girls... Can you tell the difference?
[/quote]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)