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

Creating a splitscreen mode


Although online multiplayer games have become more and more mainstream and successful over the course of the last few years, there still are games being released that feature great local multiplayer modes. Games like Mario Kart are the proof that splitscreen multiplayer is far from dead and can be great fun. This is the reason why this recipe will show you how to create a splitscreen mode for your games!

Getting ready

Follow the steps found in Setting up the game structure in Chapter 1 before proceeding with this recipe to have the base for the following sample code.

How to do it...

Let's get to work by implementing a splitscreen mode:

  1. Open the file Application.py and add the following code:

    from direct.showbase.ShowBase import ShowBase
    from direct.actor.Actor import Actor
    from panda3d.core import Vec4
    
    class Application(ShowBase):
      def __init__(self):
          ShowBase.__init__(self)
          self.pandaActor = Actor("panda", {"walk": "panda-walk"})
          self.pandaActor...