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?
Offline
well, online, the sprites should update fast enough and they should move together.
Offline
Copy the movement scripts over to the other object, I'll get a test project up in a few minutes
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
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.
Offline
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?
Offline
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)
Offline
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.
Offline
Thank you all for trying to help, but it still doesn't work right
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.
Offline
You could always take the route of combining them into a single sprite and stamping (like if you were making a 1s1s).
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)
Offline
MoreGamesNow wrote:
You could always take the route of combining them into a single sprite and stamping (like if you were making a 1s1s).
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...
Offline
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/
Offline
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!
Offline
How is this? I used "broadcast []" instead of "broadcast [] and wait"
Offline
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...
Offline
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...
Offline
My method works: http://scratch.mit.edu/projects/gamer2012TEST/2731014
Offline
gamer2012 wrote:
My method works: http://scratch.mit.edu/projects/gamer2012TEST/2731014
Actually, I added a little more than what I said, but it makes VERY little of a difference.
Offline
Oops, deleted the old project. New version: http://scratch.mit.edu/projects/gamer2012TEST/2731029
Offline
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