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

#1 2010-07-24 08:36:43

Gveradux
Scratcher
Registered: 2010-06-18
Posts: 100+

How do I make block moving

I want my spirte to go to my mouse pointer, but I want it to move every time x changes by 10.

Offline

 

#2 2010-07-24 08:48:14

colorfusion
Scratcher
Registered: 2009-10-03
Posts: 500+

Re: How do I make block moving

Do you mean you want the sprite to move in steps of ten, the sprite to move every time the mouse moves 10 X, or sprite move every time the sprite moves 10?

Offline

 

#3 2010-07-24 08:52:13

Gveradux
Scratcher
Registered: 2010-06-18
Posts: 100+

Re: How do I make block moving

Umm... I don't know how to explain it. Add this to scratch but pretend it's moving to the mouse.

<when green flag clicked>
<forever>
<change x by( 10
<wait( 1 )secsc>

Offline

 

#4 2010-07-24 08:58:02

colorfusion
Scratcher
Registered: 2009-10-03
Posts: 500+

Re: How do I make block moving

Just add a point towards mouse pointer block in there.

Offline

 

#5 2010-07-24 08:59:16

colorfusion
Scratcher
Registered: 2009-10-03
Posts: 500+

Re: How do I make block moving

Oh and do move 10 steps instead of change X by

Offline

 

#6 2010-07-24 09:02:52

Gveradux
Scratcher
Registered: 2010-06-18
Posts: 100+

Re: How do I make block moving

No.. Umm....

say the mouse was on the right hand side, I want my spirte to move in 10 X until it reaches the destination, bit like a robot.

Offline

 

#7 2010-07-24 09:34:17

Telemachus
Scratcher
Registered: 2010-04-21
Posts: 500+

Re: How do I make block moving

<when green flag clicked>
<forever>
<point towards( mouse pointer)>
<move( 10 )steps>
<wait( 1 )secsc>
<end>

Last edited by Telemachus (2010-07-24 09:35:17)


http://i54.tinypic.com/10h0fnp.jpg

Offline

 

#8 2010-07-24 09:39:04

colorfusion
Scratcher
Registered: 2009-10-03
Posts: 500+

Re: How do I make block moving

Gveradux wrote:

No.. Umm....

say the mouse was on the right hand side, I want my spirte to move in 10 X until it reaches the destination, bit like a robot.

Yes thats what the script will do.

Offline

 

#9 2010-07-24 12:50:04

graham7sarah9
Scratcher
Registered: 2009-07-19
Posts: 28

Re: How do I make block moving

So you mean like this:
<when green flag clicked>
<forever>
<wait(0.1 secsc>
<if><( <abs( (( <x position> <-> <mouse x> )) <>> <abs( (( <y position> <-> <mouse y> )) )>
<change x by(  <mouse x> <-> <x position> </> <abs( <mouse x> <-> <x position> )> <*> 10
<else>
<change y by(  <mouse y> <-> <y position> </> <abs( <mouse y> <-> <y position> )> <*> 10
<end>
<end>
Something to that extent, right?

Last edited by graham7sarah9 (2010-07-24 12:51:13)

Offline

 

#10 2010-07-24 16:56:11

coolstuff
Community Moderator
Registered: 2008-03-06
Posts: 1000+

Re: How do I make block moving

I would do something like this:

http://i29.tinypic.com/n4fhqx.gif

It checks if the mouse x position is divisible by 10 - essentially what you need - and then moves accordingly. There's a bit of lag, but that'll happen with any script you have that involves fast-moving mouse pointers.

Offline

 

Board footer