Disable mouse ?

Blitz3D Forums/Blitz3D Beginners Area/Disable mouse ?

StOrM3(Posted 2004) [#1]
Is there a way to disable the mouse for a period of time, like I want to disable the mouse so no matter what the player does with it, while in the shooting sequence and animating, taking the items off the screen, it wouldn't mess up the player coords that it returns to. Then re-enable it upon return from the playershoot function. Is this possible ? If so how ?


Rob Farley(Posted 2004) [#2]
Use this to update the mouse position

x=x+mousexspeed()
y=y+mouseyspeed()
movemouse graphicswidth()/2,graphicsheight()/2

Then don't pay attention to these commands when you don't want to.


StOrM3(Posted 2004) [#3]
how will this disable the mouse ? or are you saying that if I call mousexspeed and mouseyspeed and grab the values, then throw them away, it will be like they didn't move the mouse at all upon returning from the shooting function ?


Shambler(Posted 2004) [#4]
Yes you can do something like

dummyx=MouseXSpeed()
dummyy=MouseYSpeed()

to keep 'zeroing' if you like, the last mouse movements.

Also you can use FlushMouse() to get rid of any mouse button presses.


StOrM3(Posted 2004) [#5]
that may be what I need... the flushmouse(), because I am storing the players x,y,z coords before calling player shoot, and storing the mouse coords also, and restoring it to width/2 height/2 etc.. but every now and then, it's like intermittant, it will not return player to correct location, but the player will get stuck on the side of one of the fruit items.. may be more than one mouse click or something is getting sent or something like that.. It may also be the machine is so slow that upon returning from the function the player moves the mouse, which distorts the coords just enough so that it goes where it's not supposed to.. I will try it on a faster machine, and try it with debug off also to speed it up to full speed and see if I get the wierd bug anymore. But it only happens maybe like 3rd fruit hit, or might go whole level without happening.. can't figure it out.


Rob Farley(Posted 2004) [#6]
Here you go....

Graphics 640,480

SetBuffer BackBuffer()

x=GraphicsWidth()/2
y=GraphicsHeight()/2

Repeat

Cls

xs=MouseXSpeed()
ys=MouseYSpeed()
MoveMouse GraphicsWidth()/2,GraphicsHeight()/2

If mouseon
	x=x+xs
	y=y+ys
	EndIf

Text x,y,"X",True,True

If mouseon Then Text GraphicsWidth()/2,0,"Space to disable mouse",True:If KeyHit(57) Then mouseon=False
If mouseon=False Then Text GraphicsWidth()/2,0,"Space to enable mouse",True:If KeyHit(57) Then mouseon=True

Flip



Until KeyHit(1)



StOrM3(Posted 2004) [#7]
I would like to personally thank all of you, for your help. Although, it was not the mouse movement that was the problems, it was the new player movement with mouse code that DJWoodGate gave me, the smooth moving one, which auto-aligns using align to vector etc.. over time if no movement etc..

I ripped this code out, went back to his simple but effective mouse movement code, which jumps at gridsize increments between items, and this fixed the prob, the game is now bug free, and returns player to level where he was before entering playershoot etc.. Perfecto' I am so happy, the 3 level beta is done, and will be posted for download, and shareware release as soon as I get some webspace, I have a guy working on my webpage, so that I can take Pay Pal payments etc.. I just need to find some good cheap webhosting that we can use the pay pal code on to take orders etc..

Again, thanks to you all, finally, I finished a game, I created 2 games about 6 years ago, which did not sell very well of course this was before the internet became such a hot selling place, since then I have tried many game dev systems, Reality Factory, 3DRad, Revolution3D, all of which I could not achieve more than a 1 level demo. Now with Blitz3D, I have finally achieved Game Dev status again, and feel that the other games I have started and put on the backburner, shall now be re-written using Blitz, one at a time, until I build up my list of games again.

Thank You.

Ken


StOrM3(Posted 2004) [#8]
Oh yea, one final note, I am in a polishing phase and would like to get rid of the default text output for scoring and lives etc.. I would like to instead use BMP fonts, any ideas / libs to make this easier, btw: all the bmp fonts I have are in gif, or jpg files, with all the letters and numbers spaced out, I have tried using other programs to break the letters out and make an ini file with offsets etc.. for each letter, but I feel I will have to write an inhouse tool which loads up the gif or jpg or png file, and allows you using the mouse to select the characters, then click and have it ask you what letter this represents, you type the letter, and have it store this info in an ini file for use later so all i have to do is read in the ini file, load the png file or whatever and using the offsets create several bmp's in a type array including the letter that, that bmp represents.

I hope, that wasn't too messed up to be understood. ehehhe

Ken


Shambler(Posted 2004) [#9]
Fontext is pretty sweet.

http://www.zen28085.zen.co.uk/playerfactory/fontext/