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

#1 2012-04-28 15:14:32

Firedrake969
Scratcher
Registered: 2011-11-24
Posts: 1000+

Glide to mouse

How do I make a "glide to mouse" script?  I have

when gf clicked
   forever
      go to x: <mouse x> y: <mouse y>
   end
end
but it doesnt work.  It's too fast.


Click the sign.
https://s3.amazonaws.com/eterna/eterna2/logo2.png

Offline

 

#2 2012-04-28 15:18:40

Borrego6165
Scratcher
Registered: 2011-03-10
Posts: 1000+

Re: Glide to mouse

Complex mouse moving try something like this for VERY complex mouse movement.

otherwise your simple version would work too, except it would have to say "repeat until x = mouse x" and it keeps moving in a direction

Last edited by Borrego6165 (2012-04-28 15:19:03)


Generation:4001 Build a beautiful city, with over 50 objects and over 10000 tiles per city! This simulates traffic, pollution, tourism, crime and more!

Offline

 

#3 2012-04-28 15:21:53

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: Glide to mouse

glide (1) secs to x: (mouse x) y: (mouse y)

Offline

 

#4 2012-04-28 15:32:42

Firedrake969
Scratcher
Registered: 2011-11-24
Posts: 1000+

Re: Glide to mouse

Ok thanks, scimonster.  The only problem is that if i move the mouse too close, the plane goes slowly...

Last edited by Firedrake969 (2012-04-28 15:35:35)


Click the sign.
https://s3.amazonaws.com/eterna/eterna2/logo2.png

Offline

 

#5 2012-04-28 15:41:11

TorbyFork234
Scratcher
Registered: 2012-03-01
Posts: 1000+

Re: Glide to mouse

when gf clicked
forever
point towards [mouse pointer v]
move (1) steps
wait (0.01) secs
That should remove speed issues.

Last edited by TorbyFork234 (2012-04-28 15:41:24)

Offline

 

#6 2012-04-29 15:13:22

Firedrake969
Scratcher
Registered: 2011-11-24
Posts: 1000+

Re: Glide to mouse

Perfect.


Click the sign.
https://s3.amazonaws.com/eterna/eterna2/logo2.png

Offline

 

#7 2012-04-29 20:25:27

K-Jam
Scratcher
Registered: 2010-04-17
Posts: 100+

Re: Glide to mouse

glide (1) secs to x: (mouse x) y: (mouse y)


http://images.inmagine.com/img/imagezoo/iz162/Iz162012.jpg COMPASS!!!

Offline

 

#8 2012-05-01 11:00:28

Firedrake969
Scratcher
Registered: 2011-11-24
Posts: 1000+

Re: Glide to mouse

K-Jam, I already have a script.  Thanks though.


Click the sign.
https://s3.amazonaws.com/eterna/eterna2/logo2.png

Offline

 

Board footer