Does

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
User avatar
floogle11
Veteran
Posts: 71
Joined: Sat May 02, 2009 7:08 pm
Location: Zorgon planet
Contact:

Does

Post by floogle11 »

Does any body have a way so you can use the mouse and make a gun follow it?
Go to my Qbsite its: Trueqb.webs.com
Or if you play nazi zombies go to www.Nazizombys.com and register for cheats, hints, and strategys.
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Post by burger2227 »

I gather that you don't want to use the arrow? You want a gun instead?

Just use a standard Absolute mouse routine. The MouseDriver SUB passes variables AX, BX, CX, DX and EX. It may also have LB for left button and RB for right button. All are integers.

AX sets the mouse functions.
BX returns the button presses like RB and LB
CX returns or sets the column graphics coordinate
DX returns or sets the row graphics coordinate
EX = 1 initializes the mouse (use once at program start!)

AX: 0 = set/reset mouse; 1 = cursor on; 2 = cursor off; 3 = monitor moves and buttons; 4 = move mouse.
There are other functions to limit the mouse area and speed.

You can place a part of the gun image at a current mouse position without the cursor. If you PUT the image, you must stay within the screen maximums and minimums!
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
User avatar
coma8coma1
Veteran
Posts: 100
Joined: Sat Dec 08, 2007 5:29 pm
Location: Maryland, USA

Post by coma8coma1 »

you might also mention that when you're going to be doing your own mouse cursor you have to be careful not to draw on the screen while the mouse cursor is ON or you risk graphical glitches at and around teh cursor.

whenever you draw, 1. first turn off the mouse cursor, 2. draw your background or whatever, and then 3. turn the mouse back on. failure to do this will screw up your graphics. it's as simple as putting the mouse off call at the beginning and mouse on call at the end of every graphics routine ;) -coma8coma1
Post Reply