This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2010-10-08 16:41:43

kikiomo1999
New Scratcher
Registered: 2010-10-08
Posts: 1

Image maps in Scratch?

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

 

#2 2010-10-08 16:54:29

ScratchReallyROCKS
Scratcher
Registered: 2009-04-22
Posts: 1000+

Re: Image maps in Scratch?

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:

Code:

[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.


http://imageshack.us/a/img694/3806/sigmad.png

Offline

 

#3 2010-10-08 17:33:41

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: Image maps in Scratch?

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!


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#4 2010-10-08 17:44:41

ScratchReallyROCKS
Scratcher
Registered: 2009-04-22
Posts: 1000+

Re: Image maps in Scratch?

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.


http://imageshack.us/a/img694/3806/sigmad.png

Offline

 

#5 2010-10-09 03:28:51

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Image maps in Scratch?

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.

tongue  true i don't know why sparks didn't spot that

Offline

 

Board footer