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

#1 2012-08-09 23:48:25

LEGOengineer261
Scratcher
Registered: 2011-11-16
Posts: 100+

Sprite not going to location in time.

Hi, I'm making a project were I need a sprite to always be at a location of a sprite, but that location is moves. I need it to be always exactly where that is, or it looks horrible, because they are supposed to look like one object. I got it to work a few times, so I know it is possible, but now it is not and I'm not sure why. Does anybody know how to make something constantly be at the location without falling behind?


http://i1156.photobucket.com/albums/p562/LEGOengineer261/IronmanSERIOUSBOSS.jpg

Offline

 

#2 2012-08-09 23:59:05

thebriculator
Scratcher
Registered: 2011-07-11
Posts: 500+

Re: Sprite not going to location in time.

well, online, the sprites should update fast enough and they should move together.


.     http://tiny.cc/2cwgpw    http://tiny.cc/viwgpw    http://tiny.cc/iwwgpw

Offline

 

#3 2012-08-10 00:15:32

laptop97
Scratcher
Registered: 2011-06-27
Posts: 1000+

Re: Sprite not going to location in time.

Copy the movement scripts over to the other object, I'll get a test project up in a few minutes  smile

Done

Nevermind, it doesn't work on edges because of there no being

< sprite [sprite v] touching [sprite/mouse/edge v] >
It probably would work better using the
goto [sprite v]
block because flash is so fast.

Last edited by laptop97 (2012-08-10 00:38:58)

Offline

 

#4 2012-08-10 15:10:41

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: Sprite not going to location in time.

Here's a script that you could use in the sprite that does the following:

when gf clicked
forever
  go to x: (x position) y: (y position)
Note: You can edit add (( ) + ( )) or (( ) - ( )) to the go to block to change the position of the second sprite when compare to the first sprite.

I hope that this is what your looking for!


http://i46.tinypic.com/35ismmc.png

Offline

 

#5 2012-08-10 15:17:42

Zparx
Scratcher
Registered: 2011-03-23
Posts: 500+

Re: Sprite not going to location in time.

Turbo mode maybe? But then you'd have to base the game around turbo, which is extremely difficult. Is there any reason you can't combine the objects in Scratch's built in paint editor?


http://images3.wikia.nocookie.net/__cb20101119183412/halo/images/4/43/Hero2.png
^ My rank on Halo: Reach :3

Offline

 

#6 2012-08-10 15:18:37

gamer2012
Scratcher
Registered: 2011-04-17
Posts: 100+

Re: Sprite not going to location in time.

Does the object have velocities? If so, then it has to go to the x/y position of the character PLUS the x/y velocity.

Last edited by gamer2012 (2012-08-10 15:18:48)


Coming soon: Nothing much 'till Scratch 2.0. Oh, here's one of my classics!  tongue  Square Quest: (You BETTER click here!!! XD)

Offline

 

#7 2012-08-10 16:17:22

thebriculator
Scratcher
Registered: 2011-07-11
Posts: 500+

Re: Sprite not going to location in time.

well, let's assume you have a script similar to

forever
go to [Sprite2 v]
as I said before, it won't lag online, but offline it might lag just a little.


.     http://tiny.cc/2cwgpw    http://tiny.cc/viwgpw    http://tiny.cc/iwwgpw

Offline

 

#8 2012-08-10 20:24:08

LEGOengineer261
Scratcher
Registered: 2011-11-16
Posts: 100+

Re: Sprite not going to location in time.

Thank you all for trying to help, but it still doesn't work right  sad
I think I'll try doing it a different way then moving, cause I think the problem is that the

 ( [x position v] of [sprite v] ) 
doesn't update fast enough, or that the math for going to
 ((x position) - (Number)) 
isn't fast enough and follows behind it.  hmm

Just encase you were wondering why the lag was so important, this is for a object that has to follow part of a level map when you scroll around, and it can't be part of the map cause it isn't supposed to be available at the beginning, plus I can't make different costumes for the map, cause there are 40 of those sprites, and that would take up 2 MBs.  hmm

I wish you could print onto a sprite, then I could do it easily...


http://i1156.photobucket.com/albums/p562/LEGOengineer261/IronmanSERIOUSBOSS.jpg

Offline

 

#9 2012-08-10 21:32:29

dvd4
Scratcher
Registered: 2010-06-30
Posts: 1000+

Re: Sprite not going to location in time.

normally,scratch leaves some time between the execution of blocks,so I think that's what is causing your problem.


I made a mod  big_smile  It's called blook!
http://i49.tinypic.com/16ia63p.png

Offline

 

#10 2012-08-10 21:44:40

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

Re: Sprite not going to location in time.

You could always take the route of combining them into a single sprite and stamping (like if you were making a 1s1s).   hmm

Maybe if you attach the movement of both to a "broadcast and wait" script?

when gf clicked
forever
broadcast [frame v] and wait

when I receive [frame v]
go to x:(my_x) y:(my_y)


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

Offline

 

#11 2012-08-10 21:45:16

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

Re: Sprite not going to location in time.

Make it so that people have to use turbo mode


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

Offline

 

#12 2012-08-11 21:30:24

LEGOengineer261
Scratcher
Registered: 2011-11-16
Posts: 100+

Re: Sprite not going to location in time.

MoreGamesNow wrote:

You could always take the route of combining them into a single sprite and stamping (like if you were making a 1s1s).   hmm

Maybe if you attach the movement of both to a "broadcast and wait" script?

when gf clicked
forever
broadcast [frame v] and wait

when I receive [frame v]
go to x:(my_x) y:(my_y)

Good idea on the broadcast and wait, I think I'll try that out now...


http://i1156.photobucket.com/albums/p562/LEGOengineer261/IronmanSERIOUSBOSS.jpg

Offline

 

#13 2012-08-11 22:46:03

LEGOengineer261
Scratcher
Registered: 2011-11-16
Posts: 100+

Re: Sprite not going to location in time.

Hmm.... I tried moregamesnow's idea, but it didn't work.... Heres the scrolling map I was talking about, the game is embeded here. ninja-gaming.weebly.com/


http://i1156.photobucket.com/albums/p562/LEGOengineer261/IronmanSERIOUSBOSS.jpg

Offline

 

#14 2012-08-12 09:36:51

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

Re: Sprite not going to location in time.

Offtopic: From what I saw of the game, it looks like it's going to be amazing!  Can't wait for it to be completed!


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

Offline

 

#15 2012-08-12 12:35:27

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

Re: Sprite not going to location in time.

How is this?  I used "broadcast []" instead of "broadcast [] and wait"


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

Offline

 

#16 2012-08-13 13:11:09

LEGOengineer261
Scratcher
Registered: 2011-11-16
Posts: 100+

Re: Sprite not going to location in time.

MoreGamesNow wrote:

Offtopic: From what I saw of the game, it looks like it's going to be amazing!  Can't wait for it to be completed!

Thanks! I know... It'll be awesome! Hopefully if I can finish it...


http://i1156.photobucket.com/albums/p562/LEGOengineer261/IronmanSERIOUSBOSS.jpg

Offline

 

#17 2012-08-13 13:14:28

LEGOengineer261
Scratcher
Registered: 2011-11-16
Posts: 100+

Re: Sprite not going to location in time.

MoreGamesNow wrote:

How is this?  I used "broadcast []" instead of "broadcast [] and wait"

That looks great! I'm gonna try using the same method... I'll post something on whether it works or not...


http://i1156.photobucket.com/albums/p562/LEGOengineer261/IronmanSERIOUSBOSS.jpg

Offline

 

#18 2012-08-15 11:11:48

gamer2012
Scratcher
Registered: 2011-04-17
Posts: 100+

Re: Sprite not going to location in time.


Coming soon: Nothing much 'till Scratch 2.0. Oh, here's one of my classics!  tongue  Square Quest: (You BETTER click here!!! XD)

Offline

 

#19 2012-08-15 11:23:32

gamer2012
Scratcher
Registered: 2011-04-17
Posts: 100+

Re: Sprite not going to location in time.

Actually, I added a little more than what I said, but it makes VERY little of a difference.


Coming soon: Nothing much 'till Scratch 2.0. Oh, here's one of my classics!  tongue  Square Quest: (You BETTER click here!!! XD)

Offline

 

#20 2012-08-15 11:24:48

gamer2012
Scratcher
Registered: 2011-04-17
Posts: 100+

Re: Sprite not going to location in time.

Oops, deleted the old project. New version: http://scratch.mit.edu/projects/gamer2012TEST/2731029


Coming soon: Nothing much 'till Scratch 2.0. Oh, here's one of my classics!  tongue  Square Quest: (You BETTER click here!!! XD)

Offline

 

#21 2012-08-15 13:57:51

JH1010
Scratcher
Registered: 2012-05-31
Posts: 1000+

Re: Sprite not going to location in time.

thebriculator wrote:

well, let's assume you have a script similar to

forever
go to [Sprite2 v]
as I said before, it won't lag online, but offline it might lag just a little.

This is still a bit laggy. I took advantage of this in my Fish Trail project.

Offline

 

Board footer