Discuss Scratch

MoreReeses
Scratcher
6 posts

Making a sprite that keeps up with another

For some reason, this doesn't work to make sprites move relative to one another.
when green flag clicked
forever
go to x: ([x position v] of [Sprite1 v]) y: ([y position v] of [Sprite1 v])
end

I've made an example of the problem here:
https://scratch.mit.edu/projects/619271632/editor/

Is there a way to achieve this effect with two separate sprites, but keeping them centered at all times?

Also, I know it works in turbo mode, but that's not my ideal use case.

Last edited by MoreReeses (Dec. 19, 2021 22:56:35)

benk_b4b
Scratcher
100+ posts

Making a sprite that keeps up with another

It's taking one extra frame to move the circle to the square because Scratch runs on 30fps. If you want them both to go to the same position, I'd try a hidden sprite that moves, and both of them move to that sprite, so they are both delayed, making it appear that they are going to the same place.

You also can use
go to [Sprite1 v]
instead of
go to x: ([x position v] of [Sprite1 v]) y: ([y position v] of [Sprite1 v])

I've coded for almost 7 years, decently advanced, though I don't use scratch much anymore.

when I receive [Question v]
Try to solve(question)::custom
say (answer)

Powered by DjangoBB