Get Information About Other Sprites/Stage
-
Prerequisite
Introduction
You can use the following sensing block to get information about another sprite or the stage:

The Target Dropdown
The second input allows you to select a target object, which can be another sprite in this project, or the stage.
For example, in this project, there are 3 sprites “Cody”, “Apple” and “Avery”. If we are adding this block in the “Cody” sprite, we will see the other 2 sprites listed in the dropdown together with “Stage”:

Note that the “Cody” sprite itself is not on this list. That’s because we can use other ways to get information about this sprite itself, such as its x and y positions.
The Property Dropdown
The first input allows you to choose a property you would like to know about, such as its position or costume information. Note that this list is different if you choose the stage as the target, because the stage can not move.

Demo
Suppose we want the Cody sprite to always stay below the Apple sprite. We can add some code in the Cody sprite to repeatedly move it to the same X position as the Apple sprite, but a slightly lower Y position:

If we move the Apple sprite, then Cody will follow aumatically:

Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login