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

#1 2011-02-07 18:57:12

AlphaFire
Scratcher
Registered: 2011-02-04
Posts: 17

How To: Make a sprite guided by the mouse

[blocks]
Hi everyone:
I'm new, and probably posting on the wrong section but anyway:
Ever wanted to make a sprite like a target for a shooting game, but don't know how to make it move around the screen when you move the mouse?
Well here is a simple guide:
Click
<when green flag clicked>
<forever> <x position>
<mouse x>


Read above. That is all.

Offline

 

#2 2011-02-07 19:12:42

AlphaFire
Scratcher
Registered: 2011-02-04
Posts: 17

Re: How To: Make a sprite guided by the mouse

Next part...

<when green flag clicked><forever><y position><mouse y>


Read above. That is all.

Offline

 

#3 2011-02-07 19:21:19

AlphaFire
Scratcher
Registered: 2011-02-04
Posts: 17

Re: How To: Make a sprite guided by the mouse

Sorry, this is wrong...I am not very experenced with putting blocks in my posts
So here is the ACTUAL code
For turning left/right:
when green flag clicked
<start forever>
set x to (mouse x)
<end forever>

and for turning up/down:
when green flag clicked
<start forever>
set y to (mouse y)
<end forever>


Read above. That is all.

Offline

 

#4 2011-02-07 19:27:02

kayybee
Scratcher
Registered: 2009-12-07
Posts: 1000+

Re: How To: Make a sprite guided by the mouse

This is how you do it easily:[blocks]
<when green flag clicked>
<forever>
<go to[ mouse ]>
<end>
[/blocks]
yes, there is a block for that.

Offline

 

#5 2011-02-08 14:50:15

AlphaFire
Scratcher
Registered: 2011-02-04
Posts: 17

Re: How To: Make a sprite guided by the mouse

Oh!
Well, I didn't know that!


Read above. That is all.

Offline

 

Board footer