Names Are Important

Names Are Important

"What’s in a name? That which we call a rose by any other name would smell as sweet...”— William Shakespeare, Romeo and Juliet

Add a second sprite that is controlled by a different set of keys—use W for up, A for left, S for down, and D for right. At this point, you should have two sprites that can move independently of one another. Remember that sprites can be imported using the folder button below.

We want to be able to refer to our sprites with intuitive names. By default, your sprites will probably be called something like Sprite1 and Sprite2. Rename them by clicking on the sprite and typing into the text box, as shown below:

Do the same for both of your sprites, and you should have something that resembles:

Names are important! Naming our sprites Cat and Mouse will make programming with them much easier. Just as we used answer as a placeholder to refer to what the user types in, these names that we’ve given our sprite characters can be used as placeholders to refer to them. Giving them meaningful names makes keeping track of which is which much easier.

Try It Out!

In your first sprite’s script pane, drag the point towards [...] block into the script pane. In the drop down, you’ll notice that one of the options is your second sprite (e.g., Mouse). If we had kept the name Sprite2, that is what would have been listed. Select your second sprite so that the block now resembles:

Click the block. Move your second sprite by clicking and dragging it somewhere else. Click the block. Move your second sprite. Repeat.

Discussion Questions

  1. Describe how the name Mouse is a placeholder for the sprite associated with it.
  2. How would the program be different if we named the sprite Mus musculus instead?
  3. Imagine the following analogous scenario:
    • You are asked to face your teacher during this class. Stop and imagine what would happen if you followed this instruction. Who would you be facing? Which direction?
    • Now, imagine that you go to your next class, and you receive the same instruction. Who would you be facing? Which direction?

Likely, the context of the situations are different, so you will be facing two different directions and two different people. How is this representative of the variable nature of the name “teacher"? Also, does “face your teacher” have the same meaning for all students?