Makes ya wanna think.

Fun with Margaret and ActionScript

It was great fun teaching Margaret programming. I led her on a forced march through the Flex interface, gave a brutally quick over view of MXML (Adobe’s layout language), rushed through an intro to object-oriented programming, and finally gave a cursory glimpse at ActionScript.

M is going to develop the combat code for GODinabox.  She and Ian want to implement a fairly standard combat system for their American Dream GODclub.

While I tutored M in Flex we developed this really simple combat code harness I called FightClub, which we developed to this state. Me and BadBoy are 2 MXML components of the Pugnater class:

<?xml version=”1.0″ encoding=”utf-8″?>
<mx:Canvas xmlns:mx=”; width=”100″ height=”200″
creationComplete=”init();”  borderColor=”#800040″ backgroundColor=”#ffff00″>
<mx:Button x=”21″ y=”130″ label=”Attack” click=”this.attack();” />
<mx:Label x=”10″ y=”77″ text=”HP:”/>
<mx:Label x=”43″ y=”72″ text=”100″ id=”hpLbl” fontWeight=”bold” width=”47″ fontSize=”15″/>
<mx:Label x=”21″ y=”21″ text=”Name” id=”nameLbl”/>

private var hitPoints:Number = 100;
private var target:Pugnater;
public var attackStat:Number;
public var defenseStat:Number;

public function init():void {
this.attackStat = 5;
this.defenseStat = 2;
private function showHP():void{
this.hpLbl.text = Math.round( this.hitPoints ).toString() ;
public function defense( attackPoints:int ):void {
var randVal:Number = (Math.random() * 15 + 85)/100;

attackPoints -= this.defenseStat;
this.hitPoints -= attackPoints * randVal ;
public function setTarget( targ:Pugnater ):void { = targ;
public function attack():void { this.attackStat );


I have always wanted to teach Margaret programming. She is, after all, a third-generation computer game developer. Only recently have I been able to handle long, fun conversations. For 8 years a fun conversation automatically triggered a seizure. I got a little nerve-frazzled after about an hour of it, but took a rest and came back and gave a good final lesson, and talked through getting FightClub up and running. We’ll elaborate FightClub to let Margaret experiment with interesting combat coding.

We worked hard that night cleaning the cabin. We had to get it ready because prospective buyers were seeing it at 10 and at 12 on Friday. We got it looking pretty good and got a short night of sleep.

The next day we drove to Rice Lake. We did errands while the real estate agents showed The Pad. Got Margaret craft supplies for making creepy dolls.

Had lunch at an off little coffee shop called A Big Pile of Yesterdays or some such – it’s mainly an antique store with a coffee shop in the back. She gave me an overview of the American Dream GODclub. Very cool. I’m not going to give any theoludical spoilers. It’s going to be fun and pretty straightforward to make the GODinabox code provide the game-play features American Dream needs.

Later that night I decided to use the King of Chicago clay heads for the pirates in the Flying Spaghetti Monster GODclub. Margaret is going to make outrageous pirate costumes for them and we’ll stop-motion animate them. I think we may animate the FSM in real spaghetti. I plan to make the sets out of painted cardboard.  I want to get back into doing visual art and this feels like a way that will work.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s