Section 2

There are still some issues. The button label didn't change. That makes sense, we're not updating yet. Doh! And the color of the target cell doesn't change from yellow when we turn off the laser.

Time to get the dynamic button label working. The easiest way to do this is to give the fire button a unique name and then look up that morph when we want to update it. We know when we want to update it; it's whenever someone clicks the button. And we already have the method that responds to that action.

First, we give the button a name.

Add a method to find the fire button morph.

Then create the method that will update our fire button label.

Include the update of the button label in the code that receives the fire button event.

Okay. Let's try the morph again. We will need to close the old one, if you still have it open, and create a new one.

The button label is correct. Now we need to fix whatever is wrong with the color of the target cell.

Index Page Next Page

Copyright © 2007, 2008, 2009, 2010 Stephan B Wessels