Hi
Is it possible to create image maps similar to the ones used in web pages.
What l mean is is it possible to use the x and y co ordinates of an image to create links instead of creating invisible buttons.
I still don't know how to create an invisible button in scratch. I want to avoid having to duplicate the background image and turn it into a button.
Any advice?
Thanks
Offline
Definitely. It's not a defined feature, but you can do it. You just need to make something like this:
Say you have a 60px x 60px image. Make a script like this:
[when (sprite name) clicked] [if <<<(mouse x) < ((x position) - 15)> and <(mouse x) > ((x position) - 30)>> and <<<(mouse y) < ((y position) - 15)> and <(mouse y) > ((y position) - 30)>>>] [do some stuff here] [end if]
then, if you click the sprite in the bottom left corner, it does what you want it to do.
Offline
perfect example, SRR, that's how I would do it too! let you click multiple parts of a sprite with different results, and if you add a ((num) + (x/yposition)) block into the equation, the spaces can follow the sprite around!
Offline
sparks wrote:
perfect example, SRR, that's how I would do it too! let you click multiple parts of a sprite with different results, and if you add a ((num) + (x/yposition)) block into the equation, the spaces can follow the sprite around!
well, the way I made it the spaces would follow the sprite too.
Offline
ScratchReallyROCKS wrote:
sparks wrote:
perfect example, SRR, that's how I would do it too! let you click multiple parts of a sprite with different results, and if you add a ((num) + (x/yposition)) block into the equation, the spaces can follow the sprite around!
well, the way I made it the spaces would follow the sprite too.
true i don't know why sparks didn't spot that
Offline