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

#1 2010-12-29 20:57:06

DouresseauB-5
Scratcher
Registered: 2009-10-25
Posts: 8

How to make a sprite follow another sprite?

Help please! i was wondering how to make a sprite follow after another sprite in an x and y scroller( i want the sprite to transition behind the main sprite as the player changes directions and avoid objects if possible.) when the player has stop i also want the sprite to catch up to the main sprite.

Offline

 

#2 2010-12-29 21:02:59

kingofdallamas
Scratcher
Registered: 2010-03-07
Posts: 500+

Re: How to make a sprite follow another sprite?

Use [blocks]<go to front>[/blocks] or [blocks]<go back(  )layers>[/blocks]

THese blocks allow the sprite to go back behind other sprites by a certain number of layers or simply stay at the very front with the {go to front} block. I hope that helps!


http://i853.photobucket.com/albums/ab99/Gilgamesh1192/Ninja%20Saga/ElementalJutsus2.gifhttp://i27.photobucket.com/albums/c192/BoomKaTish/GIF/thgfhgfhfhgf.gif
ハロー友だち!

Offline

 

#3 2010-12-29 21:31:45

Magnie
Scratcher
Registered: 2007-12-12
Posts: 1000+

Re: How to make a sprite follow another sprite?

Have it point at the player sprite, then have it move towards it. Something I was working on that used Escorts: http://scratch.mit.edu/projects/Magnie/876825 Pretty basic.

Offline

 

#4 2010-12-29 21:33:27

DouresseauB-5
Scratcher
Registered: 2009-10-25
Posts: 8

Re: How to make a sprite follow another sprite?

um...sorry but that's not what i meant.
here is a picture representation (i made on ms paint) to somewhat better explain what i mean.
http://yourimagehost.com/is.php?i=46958&img=IMAGE1.jpg

Offline

 

#5 2010-12-29 21:55:14

Magnie
Scratcher
Registered: 2007-12-12
Posts: 1000+

Re: How to make a sprite follow another sprite?

Ah, yes, set it to player sprite variable x, and y, then minus or add to x or y, depending on the direction. But I'm not fully sure on how to do this.  hmm

Offline

 

#6 2010-12-30 00:17:49

Jonathanpb
Scratcher
Registered: 2008-07-25
Posts: 1000+

Re: How to make a sprite follow another sprite?

Here's a simple method, but it isn't perfect:

http://img24.imageshack.us/img24/5171/363chasingscript1.png


"Human beings... must have action; and they will make it if they cannot find it.
-Charlotte Brontë

Offline

 

#7 2010-12-30 10:51:37

DouresseauB-5
Scratcher
Registered: 2009-10-25
Posts: 8

Re: How to make a sprite follow another sprite?

i think that should work. thank you guys for all you help.

Offline

 

#8 2010-12-30 12:33:57

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

Re: How to make a sprite follow another sprite?

DouresseauB-5 wrote:

um...sorry but that's not what i meant.
here is a picture representation (i made on ms paint) to somewhat better explain what i mean.
http://yourimagehost.com/is.php?i=46958&img=IMAGE1.jpg

You can just put the image in by doing:

[img]http://yourimagehost.com/is.php?i=46958&img=IMAGE1.jpg[/img]

It produces:

http://yourimagehost.com/is.php?i=46958&amp;img=IMAGE1.jpg


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

Offline

 

Board footer