ok, so i have managed to add the right and middle mouse clicks to scratch, but i would like to be able to make a any mouse button pressed block, for left right or middle. any ideas of how i would do this? thanks.
Offline
the original 'mouse down?' block already reports if any of the three (or maybe only two cant remember) are pressed. another way around it is a longer but efficient
< <'left pressed' OR 'right pressed> OR 'middle pressed' >
EDIT!!!!!
i found out the right button pressed (it's yellow) and
I FOUND OUT HOW TO DO ANY BUTTON!!
instead of the default
^ Sensor redButtonPressed
use
^ Sensor anyButtonPressed
could you please add the code for the middle button please?
Last edited by LS97 (2010-04-16 06:17:28)
Offline
ok great! now i've also got the three buttons. but to save space in the block palette i created a <%s mouse down?> boolean block, where you can enter 'left' , 'right' , 'middle' , or 'any' in the (%s) space.
the code for the block is:
mousePressed: t1
t1 = 'left' ifTrue: [^ Sensor redButtonPressed].
t1 = 'right' ifTrue: [^ Sensor yellowButtonPressed].
t1 = 'middle' ifTrue: [^ Sensor blueButtonPressed].
t1 = 'any' ifTrue: [^ Sensor anyButtonPressed].
t1 = 'left ' ifTrue: [^ Sensor redButtonPressed].
t1 = 'right ' ifTrue: [^ Sensor yellowButtonPressed].
t1 = 'middle ' ifTrue: [^ Sensor blueButtonPressed].
t1 = 'any ' ifTrue: [^ Sensor anyButtonPressed].
^ Sensor redButtonPressedi hope that helps!
Offline
hey! i see youre online! EDIT no youre not
btw, why not go see my almost up forum on tricks with the source code?
i'm gonna add many other tricks and (maybe) a detailed tutorial (that might come later).
Last edited by LS97 (2010-04-18 03:09:23)
Offline
ok, sorry for the very late reply. i can make it into a drop-down menu, but that implements loads of other coding which i don't want to go into. so for the time being, keep it like this
Offline