| Class TBart (unit Bart) |
****** * * Module: Bart * Author: Joe Kessler * IntegrationWare - A New Generation of Extraordinary PC Solutions * www.integrationware.com * * Purpose: * * Implementation of our hero, Bart. * * Details: * * This module defines most of the look and behavior of Bart, the hero of * the game. The TBart class is derived from TVisibleObject, which * provides the core functionality that TBart requires for linking into * the rest of the universe. *
| Constructors |
constructor Create(lstUniverse: TList; iCollisionID: Integer);| Functions |
destructor Destroy;
procedure Drag;
procedure FireMissle;
procedure HandleCollision(objOtherObject: TVisibleObject);
procedure Move;
procedure ProcessMessage(iCategory, iType: Integer; bValue0: Boolean; fValue1, fValue2: Real);
procedure SetEngineFiringState(bFiring: Boolean);
procedure Thrust;| Properties |
| Events |
| Variables |
m_bEngineFiring : Boolean;
m_bFiringCannon : Boolean;
m_fLastFireTime : Real;
m_iFlame : Integer;
m_iHull : Integer;
m_inpDevice : TInputDevice;| Constructors |
constructor Create(lstUniverse: TList; iCollisionID: Integer);*** Our constructor ***
| Functions |
destructor Destroy;Bart will start under pilot control by default. Notice that Bart does NOT appear on the screen until there is a safe clearing. During this period of time he is not subject to collisions. The following list of states is used to achieve this behavior for Bart. Notice that ALL of these behaviors are implemented individually by TVisibleObject. The state queue simply gives us a way to queue the behaviors in an arbitrary order.
procedure Drag;Get the current speed of the object, and increase the speed by a fixed amount to account for the momentum provided by the thrusters. We will also cap off at a maximum allowed speed.
procedure FireMissle;Missle cannon control.
Make the engine flames visible based upon the given firing state.
procedure HandleCollision(objOtherObject: TVisibleObject);Handle Collisions.
Record the time the missle was squeezed off, so we can determine when the cannon is ready with another one.
procedure Move;Decrease the speed by a fixed percentage as if there were drag.
procedure ProcessMessage(iCategory, iType: Integer; bValue0: Boolean; fValue1, fValue2: Real);Method to handle keyboard messages.
This method gets triggered in response to input event from the current input device. Bart uses these messages to respond to user input.
procedure SetEngineFiringState(bFiring: Boolean);Engine control.
Wrap around if we've gone off the screen.
procedure Thrust;Movement methods.
Perform default procesing.
| Properties |
| Events |
| Variables |
m_bEngineFiring : Boolean;Time that Bart last fired a missle.
m_bFiringCannon : Boolean;TRUE when the engine is firing.
m_fLastFireTime : Real;Handles to the shapes comprising Bart.
m_iFlame : Integer;
m_iHull : Integer;
m_inpDevice : TInputDevice;TRUE when the cannon trigger is engaged.