That damn mouse

Blitz3D Forums/Blitz3D Beginners Area/That damn mouse

PCBGuy(Posted 2004) [#1]
OK three manuals later I still don't know! I've got player counters in my 2D gameboard as 32x32 pixel images and I want the mouse to move them from point a to point b. Mousex,mousey is not enough to control the mouse. Grabimage seems too flaky. I need to pick up any counter and move to any space. All the mouse command does is locate its x,y thats it. How does someone move a game counter on the game board, anyone???????


Perturbatio(Posted 2004) [#2]
it's a very simplistic thing, but here you go:



*EDIT*
Updated it slightly so that you can see the mouse cursor with debug mode off.


soja(Posted 2004) [#3]
I'm not sure I quite understand, but I'll try anyway.

One idea would be:
1) Poll for a mousedown (left button pressed)
2) If it is clicked on a counter, then consider that counter "grabbed"
3) In your Render routine (which should be called every game loop), update the drawing location of that counter to be MouseX and MouseY
4) Poll for a mouseup (left button released)
5) If a counter was "grabbed", "release" it and stop updating the position in your Render routine.

<EDIT> Looks like Perturbatio posted a similar answer in the meantime


PCBGuy(Posted 2004) [#4]
Thanks soooooo much, I'll try it out and see how it works. thanks to both of you for responding so quickly. I'll try to help someone one day to return the favor, though I'll most likely have more questions then answers for a while,