i want to know how to program my game to use my mouse ( i.e. instead of the space bar or down arrow). this, i would mainly use for aiming.
Offline
This should go in "Questions about Scratch" (reported to be moved), but you can use some blocks such as:
when [sprite1 v] clicked move [3] steps when gf clicked if <(mouse x) > [5]> move [3] steps end
Last edited by jvvg (2012-08-30 20:08:45)
Offline
You can retrieve the current mouse coordinates with the (mouse x) and (mouse y) blocks under the sensing tab. You can also check to see if the mouse is pressed.
(mouse x) (mouse y) <mouse down?>
Offline
You can also have a sprite follow the mouse...
when gf clicked forever point towards [mouse-pointer v] move (3) steps end
Offline
Paddle2See wrote:
You can also have a sprite follow the mouse...
when gf clicked forever point towards [mouse-pointer v] move (3) steps
Fixed.
Anyway, another block you could use is:
(touching [mouse pointer v]?)
Last edited by ErnieParke (2012-08-30 21:21:20)
Offline
For a crosshairs for aiming, you would use this script.
when gf clicked forever go to [mouse pointer v] if <mouse down?> broadcast [fire! v] and wait endThis will work for a shooting game of some sort.
Offline
As was pointed out above, there are plenty of blocks that can help you incorporate the mouse into the game. Here are all the blocks that you can use:
(mouse x)
(mouse y)
<mouse down?>
go to [mouse-pointer v]
<touching [mouse-pointer v]?>
point towards [mouse-pointer v]
(distance to [mouse-pointer v])
Offline