• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Lesson 21. Controlling Sprites with Lingo > Using locH and locV to Move the Arm

Using locH and locV to Move the Arm

Your next task is to make the robot arm react in response to the user's clicks on the buttons you just created, moving the arm up or down according to which button is clicked. The tools for this task are the sprite properties locH and locV, which return the horizontal and vertical positions, respectively, of the specified sprite in pixels (the individual dots that make up an image on the screen). You can find and set a sprite's location using locH and locV. These properties use this syntax: sprite (whichChannel).locH (or the locH of sprite whichChannel) and sprite (whichChannel).locV (or the locV of sprite whichChannel).

Sprite coordinates are relative to the upper-left corner of the stage. The (0,0) origin is at the upper-left corner of the stage. The first 0 represents the horizontal value, and the second 0 represents the vertical value. As you progress toward the right of the stage, the horizontal value increases; as you progress toward the bottom of the stage, the vertical value increases.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint