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

#1 2009-08-09 11:04:26

WeirdF
Scratcher
Registered: 2009-05-31
Posts: 1000+

Mouse Over Script

I know it's pretty basic stuff, but I've seen loads of really good games, and they don't have the mouse over script. If you don't know what I'm talking about, I'll give you an example. If you are using Windows, move your mouse over to the Start button, you'll see that it becomes highlighted, on a mac, move your mouse to the top left corner of the screen and put the cursor on the name of whatever you have open (finder, etc), it will be highlighted. You may think it is not important, but it makes the game seem more professional, so even things like this can get you more love - its! I know it is simple, but for those of you who are new and can't work it out, simply do this:

When Green Flag Pressed
[Start Forever]
If touching mouse pointer - switch to costume 1
If not touching mouse pointer - switch to costume 2
[End Forever]

That is assuming costume 1 is the highlighted costume and costume 2 is the unhighlighted one.

I don't know whether I'll get this right, but I'll have a go at doing this with the blocks feature in the forum:

<when green flag clicked>
<forever>
<if><touching[mouse pointer
<switch to costume[1
<end>
<if><<  <not>  >><touching[mouse pointer
<switch to costume[2
<end>
<end>

Thanks.

Last edited by WeirdF (2009-08-09 11:12:01)


http://i.cr3ation.co.uk/dl/s1/gif/847032b8a331def77529b6a0384db1fe_handfingers.gif

Offline

 

#2 2009-08-09 11:13:08

The-Whiz
Scratcher
Registered: 2007-07-09
Posts: 1000+

Re: Mouse Over Script

Or you can do
[if <touching [mouse-pointer]>]
[][switch to [costume1]]
[else]
[][switch to [costume2]]
[end of if]

Offline

 

#3 2009-08-09 11:18:12

WeirdF
Scratcher
Registered: 2009-05-31
Posts: 1000+

Re: Mouse Over Script

The-Whiz wrote:

Or you can do
[if <touching [mouse-pointer]>]
[][switch to [costume1]]
[else]
[][switch to [costume2]]
[end of if]

There are lots of ways to do it, you could do it with backgrounds, so that when the mouse is in a certain area, the background changes so that that part is highlighted, but if you did that it would be unnecessaryily stupid. The thing is, with your way, there can only be two costumes, other wise everything goes wrong, with my way, there can be any amount of costumes.

Last edited by WeirdF (2009-08-10 11:47:18)


http://i.cr3ation.co.uk/dl/s1/gif/847032b8a331def77529b6a0384db1fe_handfingers.gif

Offline

 

Board footer