Tuesday, October 23, 2007

Final

Been busy programming so thought I'd update my blog as haven't done it for awhile.

Feel fairly happy with the game to date. We had the following weapon implementation.


  • playstation - stunn effect. Freezes Fred in place. Affinity: Simon (i.e. only he can use it). Usage single shot (not implemented). Range: long.

  • marijuana (bong) - slows movement (by 1/2). Affinity: Simon (was going to make Fred hungry till he finds something to eat. That part wasn't implemented. I think it just slows him down. Range: short.

  • deodorant - Affinity: Fred. Slows movement same as the bong. Range: short.

  • comb - Affinity Fred. Disables pickups. Range: short.



There is a bit of imbalance between the weapons that we didn't get a chance to rectify. Simon has the advantage with the playstation as he can just stunn you and you can't run away. Simon can keep firing, so as soon as the weapon effect wears off you get stunned again. Not so hot. Was going to implement single use or limited use weapons, but didn't get time. I'd make them so they'd disappear and respawn after a certain amount of time.

Sam suggested shortening the gameplay time, making it a singleshot win or lose game i.e. make it more frantic. Also character special abilities/weapons. That would be quite interesting too.

Thursday, October 11, 2007

Update

Sorry, no update for a while - been caned with design.

Spent te weekend sorting out character movements. changed the code from a Key listener to an onEnterFrame execution. This has made the movements smoother and less jerky, and fixed the key lockouts that we were getting before.

Also sorted out the character facing different directions. Greg told me about using negative _xscale numbers to flip the characters horizontally. A bit of jiggery-pokery to sort out which way the characters are facing, but working pretty good now.
Implemented the new character walk animations with the head bobbing up and down too.

Working on weapon hit testing next.

Tuesday, October 2, 2007

ShadowedObject class

Gonna talk code now. This is a new class I created. MovieClips (aka Drawable objects) are usually drawn on one side of the screen. When characters are in the same room, the objects need to be drawn on both sides. This means keeping track of two objects, and moving both of them when movement keys are pressed. It's a bit a tedious updating two objects all the time, so experimented with overriding superclass methods.

You have main one object DrawableObject (simplified) with methods relating to position:

class DrawableObject extends Object implements Drawable {

private var xx:Number;
private var yy:Number;

public function getXx():Number {
return xx;
}

public function setXx(xx:Number):Void {
this.xx = xx;
}

public function getYy():Number {
return yy;
}

public function setYy(yy:Number):Void {
this.yy = yy;
}

}


Then I created a class ShadowedObject (simplified) as follows:

class ShadowedObject extends DrawableObject {

private var shadowObj:Drawable;

public function ShadowedObject() {
super();
shadowObj = new DrawableObject();
}

function getShadowObject():Drawable {
return shadowObj;
}

// superclass override.
public function setXx(xx:Number):Void {
super.setXx(xx);
shadowObj.setXx(xx);
}

// superclass override.
public function setYy(yy:Number):Void {
super.setYy(yy);
shadowObj.setYy(yy);
}

}


so when I do this:

var someDrawableObject:Drawable = new ShadowedObject();
someDrawableObject.setXx(200);


the shadow object 'shadowObj' gets updated as well, so I don't need to duplicate calls.
It also highlights the advantages of encapsulation (i.e. using function/method calls) because I couldn't do this if I was referring to the properties directly (eg. someDrawableObject.xx, yy).

Quite surprised as it actually works!