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

#1 2012-08-21 08:32:40

Jodymoses
Scratcher
Registered: 2012-05-03
Posts: 100+

Stick to a sprite

How do you make a sprite quick to another sprite at a velocity eg an arrow stays to the moving bullseye


http://i46.tinypic.com/2hxwx9s.png
I Have Huge Ideas, But Only If You Listen And Talk To Me...

Offline

 

#2 2012-08-21 08:44:22

BirdByte
Scratcher
Registered: 2012-07-07
Posts: 1000+

Re: Stick to a sprite

Can you elaborate? Give an example, maybe?  smile


http://i50.tinypic.com/312u714.jpg

Offline

 

#3 2012-08-21 09:01:13

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: Stick to a sprite

The simplest script is this:

forever
go to [sprite1 v]
or
forever
go to x:([x position v] of [sprite1 v]) y:([x position v] of [sprite1 v])
However there can be some lag using either script.  There are ways to combat this lag if the lag is unacceptable.

Last edited by MoreGamesNow (2012-08-21 09:01:46)


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

#4 2012-08-21 09:08:24

Jodymoses
Scratcher
Registered: 2012-05-03
Posts: 100+

Re: Stick to a sprite

ummm as i stated an arrow that  touches a moving bullseye and sticks to the area it touches


http://i46.tinypic.com/2hxwx9s.png
I Have Huge Ideas, But Only If You Listen And Talk To Me...

Offline

 

#5 2012-08-21 10:16:43

BirdByte
Scratcher
Registered: 2012-07-07
Posts: 1000+

Re: Stick to a sprite

Jodymoses wrote:

ummm as i stated an arrow that  touches a moving bullseye and sticks to the area it touches

when i receive [hit v]
set [offsetx v] to ((x position) - ([x position v] of [target v]))
set [offsety v] to ((y position) - ([y position v] of [target v]))
forever
 go to x: (([x position v] of [target v]) + (offsetx)) y: (([y position v] of [target v]) + (offsety))
end


http://i50.tinypic.com/312u714.jpg

Offline

 

#6 2012-08-21 11:10:01

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: Stick to a sprite

Jodymoses wrote:

ummm as i stated an arrow that  touches a moving bullseye and sticks to the area it touches

I am sorry.  I didn't see anything about sticking to the area it touches.  I saw you asking how to "make a sprite quick to another sprite at a velocity" and "stay to the moving bullseye"; I assumed that "bullseye" was a sprite, not a location on a sprite.  In any case, BirdByte's script should work fine, if that's what you're asking.  smile


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

#7 2012-08-21 16:38:57

Jodymoses
Scratcher
Registered: 2012-05-03
Posts: 100+

Re: Stick to a sprite

Thank you and also i made a mistake, i set my cell to prediction mode so quick 788425 is the same as stick 788425


http://i46.tinypic.com/2hxwx9s.png
I Have Huge Ideas, But Only If You Listen And Talk To Me...

Offline

 

Board footer