How can I find the position of another sprite in Snap?

Using Snap! programming language, scripts are executed in the context of their own sprite. I need to know where a sprite is positioned relative to another sprite. How do I find the position of another sprite?

+3


source to share


2 answers


There is a sensitive block called "[costume #] or []" that allows you to get properties on another sprite. [Suit #} can be changed to [x position] or [y position].

Note that you will need to select the target sprite in the right dropdown before it allows you to change the property in the dropdown on the left.



[x position] of [Other Sprite] block

+3


source


Another option:



If you are only concerned with the relative distance between Sprites, you can try the distance to another sprite . This will give you the distance between the sprite you are editing and the sprite you are looking for.

0


source







All Articles