🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: rec.games.programmer
2 messages
2 total messages Started by Albert L. Perrien II Wed, 29 Jul 1992 23:28
game library part 2
#280
Author: Albert L. Perrien II
Date: Wed, 29 Jul 1992 23:28
183 lines
5556 bytes
                Copyright (C) 1992,  Albert L. Perrien II
 
        This work may be used freely to create computer games for private use,
and for the education of individuals wishing to create computer games.  For use
in creating commercial games, please contact the Author.  The Author is not
responsible for any addictions that are created by thease games.
 

	Here's more of this ugly beast...
	Hey out there! If there is anybody feeling like critcizeing someone's
code, try mine. There always a bug in here somewhere...

	psalp@acad2.alaska.edu

 
 
        Okay, on to the buisness at hand...
=============================================================
 
        StatusType = {Alive,hit, dead, exploding}
        
 
        MonsterT = Record
                             x,y, {Current XYpos}
                             ox,oy, {old XYpos}
                             dx,dy, {XY direction}
                             sx,sy  {XY speed}
			                       			:integer;
                             MonsterType:integer;
                             status:statustype;
                             energy:integer;
                             a1,a2,a3,a4,a5,a6,a7,a8,a9:integer;   
                                           {some TScratchU variables for}
                                                    {individual monsters}
        end;
        BulletT = Record
                             x,y, {Current XYpos}
                             ox,oy, {old XYpos}
                             dx,dy, {XY direction}
                             sx,sy  {XY speed}
			                       			:integer;
                             BulletType:integer;
                             status:statustype;
                             energy:integer;
                             b1,b2,b3,b4,b5,b6,b7,b8,b9 :integer;   
                                           {some TScratchU variables for}
                                                    {individual monsters}
        end;
 
=============================================================
 
 
 
Create_Bullet
 
        Create_Bullet is passed a bullet spec from either a player or bullet. 
It finds an empty slot in the bullet array, loads in the bullet spec, and sets
the Status of the bullet to Alive.
 
 
Procedure Create_Bullet (var Bullet: Bullettype);
 
var
i:integer;
 
Begin
        Repeat i:=i+1 until Blist(i).Status:= dead;
        Blist(i):=Bullet;
        Blist(i).Status:=Alive;
end;
 
Do_Bullet
 
        This routine is a driver program that routes information to the various
bullets in the game. It is used in conjunction with the Create_Bullet and
Kill_Bullet routines (explained later) to manage the subroutines for each
individual bullet.
 
Procedure Do_Bullet
 
 
Begin
        repeat
                i:=i+1;
		
                Bullet:=Blist(i);
                With Blist(i) do
                        Begin
 
                                Case Bullettype of
                                     1:BounceBullet(Bullet);
                                          end;
                                     2:AirBullet(Bullet);
                                          end;
                                     3:DartBullet(Bullet);
                                         end;
                                     4:BoomerangBullet(Bullet);
                                         end;
                                end;
                        end;
                end;
                if Did_I_Hit(i):=true then
		   begin
			Kill_Bullet(i);
			Kill_Monster(Which_Did_I_Hit);
		   end;
                
        end;
end;
 
Kill_Bullet
 
 
        The Kill_Bullet routine removes a bullet with the identity k from the
list.  A bullet is killed whenever it moves too far away from the player
in either an x or y direction, or if it's energy is expired.
 
procedure Kill_Bullet(k:integer);
 
Begin
        Blist[k].Status:=dead;
end;
 
 
 
Did_I_Hit
 
	This boolean function returns True if a bullet hits a monster.
 
Function Did_I_Hit(k):boolean;
 
Potential_Victim:monster;
b:bullet;
 
begin
 
For I:=1 to maxMonster do 
 
begin
	 Potential_Victim:=Mlist[i];
	 B:=Blist[k];
  if ((b.x>Potential_Victim.x) and
(b.x<Potential_Victim.x+Potential_Victim.zx))
       and 
     ((b.y>Potential_Victim.y)
       and 
(b.y<Potential_Victim.y+Potential_Victim.zy))
                         {**whew**}
      then
        Did_I_Hit:=True;
      else
        Did_I_Hit:=False;
 
end; 
 
 
Function Which_Did_I_Hit(k:integer):integer;
 
begin
  I:=0;
  repeat
    I:=I+1;
    PV:=Mlist[i];
    B:=Blist[i];
    until ((b.x>pv.x) and (b.x<pv.x+pv.zx)) and ((b.y>pv.y) and
(b.y<pv.y+pv.zy))
                         {**whew again**}
   Which_Did_I_Hit:=i;
end; 
 
 
 
 
 
 
 
=============================================================
   I believe five impossible things before breakfast.
   Six is one too many...
      Albert L. Perrien II
      psalp@acad2.alaska.edu
 
Re: game library part 2
#457
Author: tomk
Date: Thu, 06 Aug 1992 02:29
7 lines
838 bytes
That's great! You say there's a bug in it..... I guess that would be a good 
way to learn that technique of programming by chasing down that nefarious
critter! 8-)
-- 
Thomas Kocourek                               : UUCP on an OS9 system,
UUCP: ...!{emory,gatech}!wa4mei!westgac3!tomk : Multitasking in 512K---
LD: (404) 834-4685                            : What a concept!
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads