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

Chapter 13. mBed Interactor > Animate a Sprite on a Path

Animate a Sprite on a Path

To modify the project created in the preceding example so that the Sprite is animated on a path, you have only to add the path and modify the mBedlet's STARTUP handler. Follow these steps:

  1. In a project with an animated Sprite already built in, click the Path Player button in the toolbar to add a path to the Players window.

  2. Right-click (Command+click on the Mac) the Path player and choose Properties from the pop-up menu to modify the Path player's parameters (see Figure 13.9).

    Figure 13.9. The Properties dialog box for setting player parameters.

  3. Select the Curve tab and change the CURVETYPE to BEZIER.

  4. Click the Playable tab and check the PLAYFOREVER check box.

  5. Drag the PATH1 object from the Players window into the Layout window (see Figure 13.10).

    Figure 13.10. Drag the PATH1 object into the Layout window.

  6. Drag the curve handles and control points to change the shape of the curve (see Figure 13.11).

    Figure 13.11. Drag the curve handles and control points to modify the shape of the curve.

  7. Right-click the MBEDLET player (Command+click on the Mac) and choose Handlers to modify the startup action that causes the animation to play. This opens the Handlers window.

  8. Delete any actions defined for the STARTUP message.

  9. Add a new action by clicking the insertion cursor button.

  10. Right-click the Player object and choose PATH1 from the pop-up menu (see Figure 13.12).

  11. Right-click the ACTION item and choose PLAY/SPRITE1 from the pop-up menu (see Figure 13.13).

  12. Close the Handler window.

  13. Click the Play button to preview the animation. The animation should cycle through the frames of the sprite as the spite animates along the path.

    Figure 13.12. Choose PATH1 from the pop-up menu.

    Figure 13.13. Choose Play/Sprite1 to define the player action.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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