Section 2

Adding Controls

We will now add some controls to the control panel portion of our LaserGame morph. The easiest thing to do is to add some simple buttons.

For certain we should have a button to Quit the game. The Quit button can close the morph.

Adding a button to Fire the laser would be good too. Although how we want that one to behave hasn't really been thought about yet. We know we want to tell the grid the laser beam is active, but maybe this would be a temporary condition. Maybe the laser beam only stays on for a short time. Or maybe only while the button is down.

We can begin by writing code to create a labeled text button.

It's simple to create specific buttons now.

We can "stub out" the action and state related methods for now.

Here's our modified method for constructing the control panel.

Open up a new LaserGame morph to see how it looks with our new buttons.

Index Page Next Page

Copyright © 2007, 2008, 2009, 2010 Stephan B Wessels    stevewessels@me.com