DeathFox Member Posts: 57 From: Registered: 04-25-2006 |
I'm making a game for my software engineering class, and its a boxing game. Anyways, I plan to use mouse gestures for the moves. So can anyone help me to track down the mouse movements. Like a left jab for example, the left mouse button should be pressed and the mouse should be moved for a left to right direction. HELP | ||
buddboy![]() Member Posts: 2220 From: New Albany, Indiana, U.S. Registered: 10-08-2004 |
ooh interesting I would like to know this also. sorry I can't help you. I will look on the blitz site to see anything about mouse position. ------------------ |
||
buddboy![]() Member Posts: 2220 From: New Albany, Indiana, U.S. Registered: 10-08-2004 |
ok found some stuff. If you want to check what mouse button they are hitting, you can either use GetMouse() or MouseDown() or MouseHit(). I think the most effective would be MouseDown. here's some (sort-of) psuedo-code implementing MouseDown():
see that would check if the left button was pushed on the mouse and then jab with the left hand then use a function that would sometimes block and sometimes not block the punch. also mouse movements? just use the MouseX and MouseY. just have your game loop store the MouseX and MouseY return variables in OldMouseX (that's a Global you create) and OldMouseY (ditto) and then have an if statement checking to see if they increase at a certain value. or decrease. like this:
See, you just have to find the right stuff. It's all there. hope that I helped you, and now you just have to implement this in a real way. *NOTE* Some of this code isn't real, obviously. all the MouseX and MouseY and MouseDown stuff is real. you have to create the Jab and Block and stuff functions. of course you don't have to do it that way, im just showing you how to make the movements and mouse buttons control it. ------------------ |
||
Lava Member Posts: 1905 From: Registered: 01-26-2005 |
Well I think you would want to use the MouseX() and MouseY() commands for this. And so basically you want to make a initial mouse value which the mouse will start in, but not be restrained to and then have the current mouse position (mouseX() and Mousey() in blitz's case) and substract that from the original starting mouse position, then take the varible that is attributed from that difference of the the 2 values, so when the mouse starts and you move it you can track the value it has when moved from that starting point. Here is a quick program I just wrote to demonstrate the ideas, it's not exact to what your game will be like, but it's to show the princibles of it all. In it you will be able to rotate a cube. Just copy and paste this into Blitz 3D.
------------------ [This message has been edited by LAVA (edited November 10, 2006).] |
||
buddboy![]() Member Posts: 2220 From: New Albany, Indiana, U.S. Registered: 10-08-2004 |
heh we said sort of the same thing. only you gave a more elaborate, correct non-psuedo-code example. ------------------ |
||
DeathFox Member Posts: 57 From: Registered: 04-25-2006 |
Thanks guys | ||
Mene-Mene![]() Member Posts: 1398 From: Fort Wayne, IN, USA Registered: 10-23-2006 |
You could also use a function called MouseXSpeed() Ex.
[This message has been edited by Mene-Mene (edited November 16, 2006).] |