Article View: rec.games.programmer
Article #232Monster library part 1
From: Albert L. Perrien II
Date: Mon, 27 Jul 1992 20:33
Date: Mon, 27 Jul 1992 20:33
78 lines
3139 bytes
3139 bytes
Copyright (C) 1992, Albert L. Perrien II This woork 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. Okay, here's the sources for part of the game library. Sorry I took so long, but I am attempting to get my sister through her first term paper. The graphics section is not finished yet, but I'm still busy typing! There are four main sections in this library: The Player manager, the monster manager, the weapon manager, and the object manager. I will also be covering various editors for each section of the game later. I do apologize for the lack of sound, but none of the IBM's at my college lab have any sound cards, and that's where I'm writing this. Perhaps someone ouyt there could explain how to use the sound blaster card in C or Paascal? I'm still a lot rough in IBM assembly. Okay, on to the buisness at hand... ============================================================= Create_Monster Create_Monster is passed a monster spec from another source, i.e. levelmap, Major monster, etc. It finds an empty slot in the monster array, loads in the monster spec, and sets the Status of the monster to Alive. Procedure Create_Monster (var Monster: Monstertype); var i:integer; Begin Repeat i:=i+1 until Mlist(i).Status:= dead; Mlist(i):=Monster; Mlist(i).Status:=Alive; end; Do_Monster This routine is a driver program that routes information to the various monsters in the game. It is used in conjunction with the Create_Monster and Kill_Monster routines (explained later) to manage the subroutines for each individual monster. Procedure Do_Monsters Begin repeat i:=i+1; Monster:=Mlist(i); With Mlist(i) do Begin Case Monstertype of 1:BounceMonster(Monster); end; 2:CrawlMonster(Monster); end; 3:DartMonster(Monster); end; 4:BirdMonster(Monster); end; end; end; end; end; end; Kill_Monster The Kill_Monster routine removes a monster with the identity k from the list. This routine omits a call to an explosion manager which would manage the explosions of all the monsters, However, I do not think that this would be too hard to write. A monster 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_Monster(k:integer); Begin Mlist[k].Status:=dead; end;
Technical Details
Message-ID:
<1992Jul27.163334.1@acad2.alaska.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!dtix!darwin.sura.net!mips!sdd.hp.com!uakari.primate.wisc.edu!usenet.coe.montana.edu!news.u.washington.edu!raven.alaska.edu!acad2.alaska.edu!psalpShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!dtix!darwin.sura.net!mips!sdd.hp.com!uakari.primate.wisc.edu!usenet.coe.montana.edu!news.u.washington.edu!raven.alaska.edu!acad2.alaska.edu!psalp From: psalp@acad2.alaska.edu (Albert L. Perrien II) Newsgroups: rec.games.programmer Subject: Monster library part 1 Message-ID: <1992Jul27.163334.1@acad2.alaska.edu> Date: 27 Jul 92 20:33:34 GMT Sender: news@raven.alaska.edu (USENET News System) Organization: University of Alaska Lines: 78 Nntp-Posting-Host: acad2.alaska.edu