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

#1 2012-09-17 14:35:12

destructo-serpent
Scratcher
Registered: 2012-07-25
Posts: 1000+

follow script

is there a simpler way to make a sprite follow a certain part of another sprite than this?

when gf clicked
forever
go to [sprite1 v]
move (1337) steps
or is that the only way??

Offline

 

#2 2012-09-17 14:42:53

meew0
Scratcher
Registered: 2010-02-22
Posts: 1000+

Re: follow script

You can do this if you want the sprite to follow another sprite at a certain speed:

when gf clicked
forever
  point towards [Sprite1 v]
  move (speed) steps
end

Last edited by meew0 (2012-09-17 14:43:28)


http://i.imgur.com/mJV3j.pnghttp://i.imgur.com/HwWAX.pnghttp://i.imgur.com/sZ7Ui.pnghttp://i.imgur.com/0y6yh.pnghttp://i.imgur.com/nOC4l.png

Offline

 

#3 2012-09-17 14:46:20

destructo-serpent
Scratcher
Registered: 2012-07-25
Posts: 1000+

Re: follow script

meew0 wrote:

You can do this if you want the sprite to follow another sprite at a certain speed:

when gf clicked
forever
  point towards [Sprite1 v]
  move (speed) steps
end

i meant like im making a game where theres a hook and a rod, the rod can move, and the hook has to move with the rod, but at the tip.

Offline

 

#4 2012-09-17 14:51:43

meew0
Scratcher
Registered: 2010-02-22
Posts: 1000+

Re: follow script

destructo-serpent wrote:

meew0 wrote:

You can do this if you want the sprite to follow another sprite at a certain speed:

when gf clicked
forever
  point towards [Sprite1 v]
  move (speed) steps
end

i meant like im making a game where theres a hook and a rod, the rod can move, and the hook has to move with the rod, but at the tip.

Then your way is the only way (as far as I know).


http://i.imgur.com/mJV3j.pnghttp://i.imgur.com/HwWAX.pnghttp://i.imgur.com/sZ7Ui.pnghttp://i.imgur.com/0y6yh.pnghttp://i.imgur.com/nOC4l.png

Offline

 

#5 2012-09-17 14:54:10

destructo-serpent
Scratcher
Registered: 2012-07-25
Posts: 1000+

Re: follow script

k thanks then

Offline

 

#6 2012-09-19 03:01:54

TPAL125
Scratcher
Registered: 2012-06-09
Posts: 18

Re: follow script

First use your script. Then put the hook where you want it. After that use this script:

when gf clicked
set [a v] to (([x position v] of [rod v]) - (x position))
set [b v] to (([y position v] of [rod v]) - (y position))
Now use this to keep the hook in place:

forever
go to x:(([x position v] of [rod v]) - (a)) y:(([y position v] of [rod v]) - (b))
end

Offline

 

Board footer