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

#1 2012-06-27 02:47:45

thion
Scratcher
Registered: 2012-05-04
Posts: 19

scrolling: how do i make sprites follow other sprite?

i was making a y and x scrolling game but i can't fiish because i don't know how make  sprites follow other sprite

i was scrolling with this

when flag clicked
forever
go to x: ((scrollX) + ((480) * (0))) y: ((scrolly) + ((360) * (0)))
end

Last edited by thion (2012-06-27 02:51:00)


http://i.imgur.com/aYMfC.png

Offline

 

#2 2012-06-27 03:24:44

SciTecCf
Scratcher
Registered: 2011-11-23
Posts: 1000+

Re: scrolling: how do i make sprites follow other sprite?

What exactly do you mean?


http://bit.ly/LCZEJRhttp://bit.ly/LSONcOhttp://bit.ly/LF3vIc
http://trinary.site40.net/images/scratchrank.php?username=SciTecCf&display=small

Offline

 

#3 2012-06-28 01:19:30

SOScratch
Scratcher
Registered: 2010-02-01
Posts: 100+

Re: scrolling: how do i make sprites follow other sprite?

Oh, I see what you mean.
You want a sprite that follows the first sprite.

That is some pretty hard stuff to do...
I am not quite sure of it myself but I am sure you will need to have some of the same scripts on the following sprite.
Just set that sprite to do everything the first sprite does, just exclude the player's control over it and add a delay so it does not always overlap the player sprite.

Hope this helped a little!


-SOScratch
Scratch On!

Offline

 

#4 2012-06-28 13:03:16

Frankie101
New Scratcher
Registered: 2012-06-28
Posts: 28

Re: scrolling: how do i make sprites follow other sprite?

I was stuck on this at first, but after a while I found out what to do:

Click on the Sprite that you want to follow the other sprite. Then add this script:

[scratchblocks]
when gf clicked
forever
go to sprite ...
[scratchblocks]

Sorry if the scratch block doesnt work It's my first time at doing them  wink

Hope this helps  smile

Offline

 

#5 2012-06-28 13:06:27

Frankie101
New Scratcher
Registered: 2012-06-28
Posts: 28

Re: scrolling: how do i make sprites follow other sprite?

That was a fail lol!! If you don't understand the meant to be scratch block, its when green flag clicked, forever, go to sprite (number) and that should work.

Offline

 

#6 2012-06-28 13:53:50

Prestige
Scratcher
Registered: 2008-12-15
Posts: 100+

Re: scrolling: how do i make sprites follow other sprite?

Frankie101 wrote:

I was stuck on this at first, but after a while I found out what to do:

Click on the Sprite that you want to follow the other sprite. Then add this script:

when gf clicked
forever
go to [sprite ... v]
Sorry if the scratch block doesnt work It's my first time at doing them  wink

Fixed.
use /scratchblocks at the end to close  smile
Hope this helps  smile

Last edited by Prestige (2012-06-28 15:35:40)


"Don't insult someone until you've walked a mile in their shoes. That way, if they don't like what you have to say, you'll be a mile away and still have their shoes  smile  "

Offline

 

#7 2012-06-28 14:00:31

Frankie101
New Scratcher
Registered: 2012-06-28
Posts: 28

Re: scrolling: how do i make sprites follow other sprite?

Ahh thanks! Although the go to sprite bbit is meant to be dark blue, but not sure if that matters or not  smile

Offline

 

#8 2012-06-28 14:20:27

zammer990
Scratcher
Registered: 2012-01-22
Posts: 500+

Re: scrolling: how do i make sprites follow other sprite?

To do this, you use a normal follow script "point towards, move x steps" and then you make the sprite react the opposite way you do to movement keys, for example if you press up, you may go up but it goes down, this gives the effect of moving away, and if you do the opposite, you go towards it


http://i45.tinypic.com/2ynq7nn.jpg Play now!

Offline

 

#9 2012-06-28 15:34:57

Prestige
Scratcher
Registered: 2008-12-15
Posts: 100+

Re: scrolling: how do i make sprites follow other sprite?

Frankie101 wrote:

Ahh thanks! Although the go to sprite bbit is meant to be dark blue, but not sure if that matters or not  smile

Its because its a drop down, go to (drop down list). To do that you add a drop down arrow, 'v', so it becomes:

go to [sprite 1 v]

 go to [sprite 1 v] 
smile

(Fixed above, again, too)

Last edited by Prestige (2012-06-28 15:36:10)


"Don't insult someone until you've walked a mile in their shoes. That way, if they don't like what you have to say, you'll be a mile away and still have their shoes  smile  "

Offline

 

#10 2012-08-30 19:49:41

thion
Scratcher
Registered: 2012-05-04
Posts: 19

Re: scrolling: how do i make sprites follow other sprite?

hola

http://i.imgur.com/75jl7.png


http://i.imgur.com/aYMfC.png

Offline

 

#11 2012-11-14 13:22:30

thion
Scratcher
Registered: 2012-05-04
Posts: 19

Re: scrolling: how do i make sprites follow other sprite?

Space Ham Studios

                                                                                                                             

http://i.imgur.com/a1HoT.png


http://i.imgur.com/aYMfC.png

Offline

 

#12 2012-11-14 18:42:30

sccar3
Scratcher
Registered: 2008-09-04
Posts: 100+

Re: scrolling: how do i make sprites follow other sprite?


when gf clicked

forever  

set [Delta_x v] to ((Your_X) - (x))

set [Delta_y v] to ((Your_Y) - (y))

if <(Delta_y) = [0]>

if <(Delta_x) < [0]>

set [direction v] to [-90]

else

set [direction v] to [90]

end

else

if <(Delta_y) < [0]>

set [direction v] to ((180) + ( [atan v] of ((Delta_x) / (Delta_y))))

else

set [direction v] to ( [atan v] of ((Delta_x) / (Delta_y)))

end

end

change [x v] by (( [sin v] of (dir)) * (4))

change [y v] by (( [cos v] of (dir)) * (4))

end

This is for the enemy sprite. The Your_X and Your_Y are your character's x and y.

Last edited by sccar3 (2012-11-14 18:46:01)


http://1.bp.blogspot.com/-WInb2DZ2LBM/UQaLETx3VII/AAAAAAAAAmQ/ZOpSwEPggiE/s1600/The%2BElder%2BScrolls%2BOnline%2BSignup%2BBeta.jpg

Offline

 

Board footer