Solar System(events) Tutorial

This tutorial will cover events and how they can be used in Panda. Specifically, this lesson will use events to capture key presses and mouse clicks to trigger actions in the world. It will also use events to count the number of orbits the Earth makes around the sun.

Events are 'signals' that are sent within a Panda world. These signals are then recieved by an event handler which in turn does something. For instance, when a key on the keyboard is pressed, a 'signal' is sent within a Panda world. We can put a special event handler in place for a specific key and have it call a function that will do something in the world. Events don't have to be generated by input devices like the keyboard and mouse. Events can be generated entirely within the program. For instance, every time the interval for rotating the Earth completes, it sends an event to update the counter keeping track of Earth revoluions.

This tutorial will use the same base code from the solar system tutorial. However, the comments from that tutorial will be left out. All of the comments in this tutorial will be solely for events. For more information on events, please refer to the events section of the online manual.

Once complete, the solar system events program can be controlled with the specified keys that will be ountlined in the upper left corner of the Panda window(see image below). Try turning the verious planets ON and OFF. Also try adding a counter for the other planets and changing the key assignments.