The artificial intelligence routines handle both the AI computer-controlled units and the human player's movement, as well as hit detection. These routines are also the basic data manipulation for the game
; ----------------------------------------------
; UnitUpdate
;
; Inputs: UnitArray -- An Array containg the infor of all the units on the screen
; DS is assumed to be equal to CSEG
;
; Outputs: UnitArray -- Updated position variables
;
; Input/Output: Nothing.
;
; Purpose: The Artificial Intelligence for the computer controlled units
;
; Written by: Matthew Curry
; -----------------------------------------------
; ----------------------------------------------
; BulletUpdate
;
; Inputs: BulletArray
;
; Outputs: BulletArray
;
; Input/Output: Nothing.
;
; Purpose: Moves the bullets into their new locations
;
; Written by: Matthew Curry
; -----------------------------------------------
; ----------------------------------------------
; CollisionDetect
;
; Inputs: BulletArray & UnitArray
;
; Outputs: Updated inputs
;
; Input/Output: Nothing.
;
; Purpose: boundary detection, to determine when things
; die and aren't required on screen anymore.
;
; Written by: Matthew Curry
; -----------------------------------------------
; ----------------------------------------------
; addNewEnemy
;
; Inputs: Image of type of enemy to be encountered & UnitArray
;
; Outputs: UnitArray is updated with it's stats
;
; Input/Output: Nothing.
;
; Purpose: to create new enemies to fight
;
; Written by: Matthew Curry
; -----------------------------------------------
; ----------------------------------------------
; Collision
;
; Inputs: position of player and position of enemy units
;
; Outputs: Destruction if there is a collision
;
; Input/Output: Nothing.
;
; Purpose: This method uses a simple but not very efficient circle
; (deltaX^2 + deltaY^2 = RADIUS^2) to detect collisions. As such, each
; unit must be approximated by a circular radius
;
; Written by: Nathan Hamstra
; -----------------------------------------------
The artificial intelligence structures will be described below.
|
Unit STRUC IDUnit db ? ;bit 7=1 if nonplayer status db 10b ;ACTIVE, ; INACTIVE -- All units start here ; DEAD, ; JUSTFIRED path db 00000001b ;To be determined - possibly straight, zigzag; plus ; different values for the ground units (2nd level) ; Bit 0=1 if unit heads straight across screen ; Bit 1=1 if unit zig-zags ; Bit 2=1 if unit is on player avoidance course ; Bit 3=1 if unit is on player pursuit course ; Bit 4-7 indicate player independent direction FireRate db ? ;in time interrupts between shots. MovementRate db ? ;in 32nds of a pixel, timer interrupts=32 times/sec RowPosition dw ? ;the VGA screen row pos., in pixels ColumnPosition dw ? ;the VGA screen column pos., in pixels Image db ? ;unit's picture timeOfFire dw ? ;ime when unit last fired, unused so far Unit ENDS |
|
Bullet struct ;structure for storing the projectiles bstatus db 1 ; 1=bullet inactive, 0=bullet active direction db ? ; 1 if right, 0 if left positionr dw ? ;Bullet position, row and column positionc dw ? Bullet ends |
These are all of the constants used for the Artifical Intelligence Routines