Book Image

Panda3D 1.7 Game Developer's Cookbook

Book Image

Panda3D 1.7 Game Developer's Cookbook

Overview of this book

Table of Contents (20 chapters)
Panda3D 1.7 Game Developer's Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Making animations fit to intervals


Intervals are a very powerful feature of Panda3D, which you can see in the recipe Controlling actions using intervals. In this recipe you will go one step beyond and see how to efficiently control animations when used in conjunction with intervals.

Getting ready

If you haven't already, please read how to use intervals in Controlling actions using intervals and follow the steps of that recipe.

How to do it...

This recipe consists of the following tasks:

  1. Open Application.py.

  2. Delete the line self.panda.loop("walk").

  3. Find the following part of the code:

    self.pandaWalk = Sequence(self.walkIval1, self.turnIval1, self.colorIval, self.walkIval2, self.turnIval2,
    self.colorIval)
    self.pandaWalk.loop()
  4. Replace it with the following code:

    self.pandaAnim = ActorInterval(self.panda, "walk", loop = 1, duration = 5)
    self.pandaMove = Sequence(self.walkIval1, self.turnIval1, self.colorIval, self.walkIval2, self.turnIval2, self.colorIval)
    self.pandaWalk = Parallel(self.pandaAnim, self...