I had a script which detected mouse clicks and started drawing. However, it was activated when the mouse was off the stage area, meaning that drawing was in a bad location.
Shouldn't the mouse input to the scripts be limited to when it is over the stage?
Hugh
Offline
If you are testing for mouse down it will detect when a mouse button is down wherever the mouse is. You could build a check into your script to check the mouse x and mouse y position.
Forever if mouse down and mouse x > -240
move 10 steps
if on edge, bounce
will move the sprite while your mouse is over the stage but it will stop if you move off to the left. You will need to add checks for the other edges of the stage to trap the mouse clicks on the stage only.
Offline
Yes, I had to add those workarounds to make sure the mouse is on the stage.
It was kind of confusing - I was getting a red error outline around my script, and finally realised that it was due to me clicking to change the script and the clicks being detected by another script.
If Scratch is to be as simple and foolproof as possible I don't see any possible reason why you would want to know about mouse clicks (or movements) off the stage. In fact, with a bit of tricky programming you could detect what was being clicked on in the scratch workspace. Not good.
Hugh
Offline