Home » Source Code » » GAME.PAS

GAME.PAS ( File view )

From:
  • By 2010-07-21
  • View(s):9
  • Download(s):0
  • Point(s): 1
			Program Game;

{
$X+
}

Uses
   Anivga, Crt, Dos, Music;

Const
   Apples : Array[0..1,0..9] of Integer =((280,260,5,15,200,240,305,260,80,0),
                                          (120,90,95,70,60,5,60,35,120,0));

   TileName2    ='esp.COD';   {
4 tiles
}
   tiles_per_row=4;           {
These are the proportions of 
}
   tiles_per_column=4;        {
the above 4 tile file: 2x2!  
}
   BlokName     = 'line.cod';
   BlokHantel   = 50;
   Blok         = 50;
   FellowName   = 'smallnumo.lib';
   FellowHantel = 30;
   Fellow       = 30;
   MaxX         = 190;
   MinX         = 10;
   Apple        = 90;
   AppleHantel  = 90;
   Spook        = 10;
   SpookHantel  = 10;

var
  PicsLoaded,
           T,
 FellowImage,   {
* actual fellow image   *
}
      Teller,   {
* counting variable     *
}
     dx_left,   {
* velocity to the left  *
}
    dx_right,   {
* velocity to the right *
}
          dy,   {
* vertical velocity     *
}
       score,   {
* score                 *
}
      OldFel,   {
* old fellow image      *
}
 Totalapples,   {
* apples got till now   *
}
       Level,   {
* which level?          *
}
        ydir    {
* used for 'lift'       *
}

                : Integer;

       Right,   {
* right arrow key pressed*
}
        Left,   {
* left arrow key pressed *
}
   FirstLeft,   {
* the first time to left *
}
  FirstRight,   {
* the first time to right*
}
        Jump,   {
* jump key pressed       *
}
     Jumping,   {
* busy with jumping      *
}
     Falling,   {
* busy with falling      *
}
        Stop,   {
* stop program           *
}
    OnGround,   {
* reached the ground     *
}
     NoMusic    : boolean;

    scorestr,   {
* necessary for display  *
}
    levelstr    {
* necessary for display  *
}
                : String;

          x,
          y     : real;

     OldInt9: procedure;

       ScoreScr : Pointer;
   
Procedure trapCtrlAltDel; interrupt;
begin
    case Port[$60] of
        1: Stop   := True;
       83: NoMusic:= Not NoMusic;
       75: Left   := True;
       77: Right  := True;
       29: Jump   := True;
      157: Jump   := False;
      203: Left   := False;
      205: Right  := False;

    end;

    Inline ($E4/$61/$8A/$E0/$0C/$80/     {
 clean up as BIOS would 
}
          $E6/$61/$86/$E0/$E6/$61/       {
 (from Ohlsen & Stoker, 
}
          $B0/$20/$E6/$20);              {
 TP Advanced Techniques) 
}
end;

procedure installTrap;
begin
   getintVec($09,@oldInt9);
   setintVec($09,Addr(trapCtrlAltDel));
end;

procedure uninstallTrap;
begin
   setintVec($09,@oldInt9);
end;


procedure InitBackGround;
VAR gx,gy,count:INTEGER;
    Row:WORD;
begin

 XTiles:=0; YTiles:=0;
 SetBackgroundMode(scrolling);
 SetBackgroundScrollRange(0,-250,378,550);
 {
paste tiles into this background, using circular enumeration 1,2,3,4,1,...
}
 count:=0; Row:=0;
 gy:=BackY1;
 REPEAT
  gx:=BackX1;
  REPEAT
   PutTile(gx,gy,succ(count + (Row MOD tiles_per_column)*tiles_per_row));
   inc(count); count:=count MOD tiles_per_row;
   inc(gx,16);
  UNTIL gx>BackX2;
  inc(Row); {
or: Row:=(Row+1) MOD tiles_per_row
}
  inc(gy,16);
 UNTIL gy>BackY2;

For gx:=0 to 5 Do
 begin
  Color:=gx+5;
  Line(0,gx,316,gx,PAGE);
 end;
 For gx:=0 To 5 Do
 begin
  Color:=10-gx;
  Line(0,gx+6,316,gx+6,PAGE);
 end;
 OutTextXY(5,2,PAGE,'SCORE:      LEVEL:      Made by BoeierBoyszz tm');
 ScoreScr:=GetImage(0,0,316,10,PAGE);
end;


Procedure InitSprites;
begin
  if loadpalette('standard.pal',0,actualColors)=0
  then BEGIN
        closeroutines;
        WRITELN('Couldn''t access file  : '+GetErrorMessage);
        uninstallTrap;
        halt
       END
  ELSE
   SetPalette(actualColors,TRUE);

    
  PicsLoaded:=loadSprite(BlokName,BlokHantel);
  IF Error<>Err_None
  THEN BEGIN
        CloseRoutines;
        WRITELN('Couldn''t access file '+BlokName+' : '+GetErrorMessage);
        uninstallTrap;
        halt(1)
       END;

   for teller:=0 to 3 do
   begin
     SpriteN[Blok+teller]:= BlokHantel;
     SpriteX[Blok+teller]:= 12+teller*85;
     SpriteY[Blok+teller]:= 168;
   end;

   

   SpriteN[Blok+4]:= BlokHantel;
   SpriteX[Blok+4]:= 132;
   SpriteY[Blok+4]:= 136;

   SpriteN[Blok+5]:= BlokHantel;
   SpriteX[Blok+5]:= 32;
   SpriteY[Blok+5]:= 106;

   SpriteN[Blok+6]:= BlokHantel;
   SpriteX[Blok+6]:= 75;
   SpriteY[Blok+6]:= 78;

   for teller:=0 to 2 do
   begin
     SpriteN[Blok+7+teller]:= BlokHantel;
     SpriteX[Blok+7+teller]:= teller*85;
     SpriteY[Blok+7+teller]:= 48;
   end;

   SpriteN[Blok+10]:= BlokHantel;
   SpriteX[Blok+10]:= 0;
   SpriteY[Blok+10]:= 15;

   SpriteN[Blok+11]:= BlokHantel;
   SpriteX[Blok+11]:= 85;
   SpriteY[Blok+11]:= -15;

   PicsLoaded:=loadSprite(FellowName,FellowHantel);
   IF Error<>Err_None
   THEN BEGIN
        CloseRoutines;
        WRITELN('Couldn''t access file smallnumo.lib : '+GetErrorMessage);
        uninstallTrap;
        halt(1)
   END;

   PicsLoaded:=loadSprite('Spook.lib',SpookHantel);
   IF Error<>Err_None
   THEN BEGIN
        CloseRoutines;
        WRITELN('Couldn''t access file spook.cod : '+GetErrorMessage);
        uninstallTrap;
        halt(1)
   END;
   SetSpriteCycle(Spook, PicsLoaded);
   SetCycleTime(10);

   PicsLoaded:=loadSprite('quest.lib',AppleHantel);
   IF Error<>Err_None
   THEN BEGIN
        CloseRoutines;
        WRITELN('Couldn''t access file quest.lib : '+GetErrorMessage);
        uninstallTrap;
        halt(1)
   END;

   SetSpriteCycle(Apple,Picsloaded);

   LoadTile(TileName2,1); {
load the 4 tiles as tile #1..4 = inner picture
}
   IF Error<>Err_None
    THEN BEGIN
        CloseRoutines;
        WRITELN('Couldn''t access file '+TileName2+' : '+GetErrorMessage);
        uninstallTrap;
        halt(1)
       END;


end;

Procedure InitVars;
begin
   TotalApples:=10;
   Level      :=1;
   dy         :=1;
   dx_left    :=0;
   dx_right   :=0;
   FellowImage:=0;
   score      :=0;
   ydir       :=2;
   Jumping    :=False;
   Falling    :=False;
   Jump       :=False;
   Stop       :=False;
   Right      :=False;
   Left       :=False;
   FirstRight :=True;
   FirstLeft  :=True;
   NoMusic    :=False;
end;


function hitground: Boolean;
begin
  OldFel:= SpriteN[Fellow];
  if OldFel>7 then
   SpriteN[Fellow]:= FellowHantel+7+2
  else
   SpriteN[Fellow]:= FellowHantel+2;

  For teller:= 50 to 62 do
    if HitDetect(Fellow,teller) then
      if (SpriteY[Fellow]+14)<SpriteY[teller] then
      begin
           SpriteN[Fellow]:= OldFel;
           hitground:= True;
           exit;
      end;
   SpriteN[Fellow]:= OldFel;
   hitground:= False;
end;


procedure CheckXY;
begin
    If Right Then
    begin
      if OnGround and Not NoMusic Then PlayMusic('O2C');

      If FirstRight Then
        begin
          FirstRight:=False;
          FellowImage:=0;
        end;
      SpriteN[Fellow]:=(FellowHantel+7) + FellowImage;
      FellowImage:=(FellowImage+1) mod 6;
    end
    else
      FirstRight:=True;

    If (Right and (dx_right<8))
      then {
* fellow rechts versnellen *
}
        Inc(dx_right,2);

    If Left Then
    begin
      if OnGround and Not NoMusic Then PlayMusic('O2C');
      If FirstLeft Then
      begin
        FirstLeft:=False;
        FellowImage:=0;
      end;
      SpriteN[Fellow]:=(FellowHantel) + FellowImage;
      FellowImage:=(FellowImage+1) mod 6;
    end
    else
      FirstLeft:=True;

   If Left and (dx_left<8) then {
* increase fellow's speed to the left *
}
         Inc(dx_left,2);


   If (not Right) then
     If (dx_right>0) then  {
* reduce fellow's speed to the right*
}
       Dec(dx_right,2);
   If (not Left) then
    If (dx_left>0) then    {
* reduce fellow's speed to the left *
}
       Dec(dx_left,2);


   if dy<=9 then
      Inc(dy);

   if not OnGround then
     if SpriteN[Fellow]< FellowHantel+7 then
       SpriteN[Fellow]:= FellowHantel+ 3
     else
       SpriteN[Fellow]:= FellowHantel +7 +3;

    if OnGround and not Right and not Left then
     if SpriteN[Fellow]< FellowHantel+7 then
  
...
...
(Please download the complete source code to view)
			
...
Expand> <Close

Want complete source code? Download it here

Point(s): 1

Download
0 lines left, continue to read
Sponsored links

File list

Tips: You can preview the content of files by clicking file names^_^
Name Size Date
ANIVGA.DOC220.35 kB07-11-93|18:45
ANIVGA.ENG320.98 kB07-11-93|18:45
ANIVGA.PAS318.61 kB07-11-93|18:45
ANIVGA.TUT12.66 kB07-11-93|18:45
BFFFFFFF.PAS2.02 kB07-11-93|18:45
CHANGES.TXT4.76 kB07-11-93|18:45
COMPRESS.PAS38.98 kB07-11-93|18:45
DATEIEN.PAS45.08 kB07-11-93|18:45
DUMP_SPR.PAS10.05 kB07-11-93|18:45
EINGABEN.PAS8.68 kB07-11-93|18:45
EXAMPL12.PAS3.77 kB07-11-93|18:45
EXAMPLE1.PAS1.58 kB07-11-93|18:45
EXAMPLE2.PAS1.89 kB07-11-93|18:45
EXAMPLE3.PAS3.24 kB07-11-93|18:45
EXAMPLE4.PAS1.64 kB07-11-93|18:45
EXAMPLE5.PAS2.92 kB07-11-93|18:45
EXAMPLE6.PAS3.98 kB07-11-93|18:45
EXAMPLE7.PAS3.03 kB07-11-93|18:45
EXAMPLE8.PAS2.82 kB07-11-93|18:45
EXAMPLE9.PAS1.38 kB07-11-93|18:45
FAQ.TXT11.99 kB07-11-93|18:45
07.00 B
2_HEBREW.FNT3.51 kB11-03-92|10:38
30.FNT3.26 kB11-03-92|10:39
33Q.FNT3.01 kB11-03-92|10:39
36.FNT2.76 kB11-03-92|10:39
44.FNT2.26 kB11-03-92|10:39
8X10.FNT2.51 kB11-03-92|10:38
8X11SNSF.FNT2.76 kB11-03-92|10:38
8X14.FNT3.51 kB11-03-92|10:38
ALPS.FNT3.51 kB11-03-92|10:37
ALPS10.FNT2.51 kB11-03-92|10:37
ALPS11.FNT2.76 kB11-03-92|10:37
ALPS6.FNT1.51 kB11-03-92|10:37
ALPS7.FNT1.76 kB11-03-92|10:37
ALPS8.FNT2.01 kB11-03-92|10:37
ANTIQUE.FNT3.51 kB11-03-92|10:38
APLS9.FNT2.26 kB11-03-92|10:37
B814.FNT3.51 kB11-03-92|10:39
BIGSERIF.FNT3.51 kB11-03-92|10:38
BLCKSNSF.FNT2.51 kB11-03-92|10:38
BLOCK.FNT3.51 kB11-03-92|10:38
BOLD.FNT3.51 kB11-03-92|10:38
BROADWAY.FNT3.51 kB11-03-92|10:38
CNTDOWN.FNT3.51 kB11-03-92|10:37
COMPUTER.FNT3.51 kB11-03-92|10:38
COURIER.FNT3.51 kB11-03-92|10:38
CYRILLIC.FNT3.51 kB11-03-92|10:38
DEFAULT.FNT1.51 kB11-03-92|10:39
FIRE.FNT52.26 kB11-03-92|18:45
FIRE.PAL768.00 B11-03-92|18:45
FRANKFRT.FNT3.51 kB11-03-92|10:37
FRESNO.FNT3.51 kB11-03-92|10:38
FUTURE.FNT3.51 kB11-03-92|10:38
GAELIC.FNT3.51 kB11-03-92|10:37
GEORGIAN.FNT3.51 kB11-03-92|10:37
GREEK.FNT3.51 kB11-03-92|10:38
HOLLOW.FNT3.51 kB11-03-92|10:38
HUGE.FNT4.01 kB11-03-92|10:39
HYLAS.FNT3.51 kB11-03-92|10:38
ITALIC.FNT3.51 kB11-03-92|10:37
ITALICS.FNT3.51 kB11-03-92|10:37
ITT.FNT3.51 kB11-03-92|10:38
LCD.FNT3.51 kB11-03-92|10:38
MEDIEVAL.FNT3.51 kB11-03-92|10:38
MODERNFO.FNT4.01 kB11-03-92|10:39
OCR.FNT3.51 kB11-03-92|10:37
OLDENG.FNT3.51 kB11-03-92|10:37
ROMAN.FNT3.51 kB11-03-92|10:39
SANSERIF.FNT3.51 kB11-03-92|10:39
SCRIBBLE.FNT4.01 kB11-03-92|10:39
SCRIPT.FNT3.51 kB11-03-92|10:37
SCRIPT2.FNT3.51 kB11-03-92|10:39
SENAPL.FNT3.51 kB11-03-92|10:37
SIDE.FNT2.51 kB11-03-92|10:37
SIMILITE.FNT3.51 kB11-03-92|10:39
SMALCAPS.FNT3.51 kB11-03-92|10:39
STRETCH.FNT3.51 kB11-03-92|10:39
SUPER.FNT2.01 kB11-03-92|10:39
THAI.FNT3.51 kB11-03-92|10:39
THIN.FNT3.51 kB11-03-92|10:39
THIN8X8.FNT2.01 kB11-03-92|10:39
_BROADWA.FNT8.01 kB11-02-92|12:06
_OCR.FNT3.51 kB11-03-92|10:39
GRAB.EXE14.53 kB07-11-93|18:45
GRAB.PAS45.71 kB07-11-93|18:45
07.00 B
AEGYPTEN.COD1.30 kB06-12-92|21:42
BLACK.COD434.00 B06-12-92|21:54
FLOWER.COD3.26 kB03-20-92|14:04
FRACTAL.PAL768.00 B07-03-93|16:12
FRACTAL1.PIC62.50 kB07-03-93|16:12
FRACTAL2.PIC62.50 kB07-03-93|16:13
FRACTAL3.PIC62.50 kB07-03-93|16:13
FRACTAL4.PIC62.50 kB07-03-93|16:14
HANTEL.LIB4.77 kB11-10-91|15:20
MARMOR.COD8.80 kB06-13-92|18:38
RANDOM.PAL768.00 B07-17-92|19:31
TILE2.COD1.30 kB10-20-91|13:57
WHATSNEW.LIB1.72 kB06-12-93|20:09
07.00 B
APPLE.COD290.00 B10-02-92|05:34
ESP.COD4.55 kB10-05-92|15:06
GAME.EXE43.13 kB07-04-93|12:21
GAME.PAS12.00 kB07-04-93|13:46
LINE.COD1.02 kB09-25-92|18:55
MUSIC.PAS20.14 kB09-24-92|16:52
MUSIC.TPU4.89 kB07-04-93|12:21
QUEST.LIB4.53 kB10-05-92|15:51
README.TXT549.00 B07-04-93|13:47
SMALLNUM.LIB13.00 kB09-27-92|16:24
SPOOK.LIB3.57 kB10-02-92|07:36
STANDARD.PAL768.00 B09-25-92|18:53
MAKE.BAT165.00 B07-11-93|18:45
MAKES.PAS218.08 kB07-11-93|18:45
PCX2COD.DOC852.00 B07-11-93|18:45
PCX2COD.PAS77.98 kB07-11-93|18:45
README.1ST2.87 kB07-11-93|18:45
README.2ND4.12 kB07-11-93|18:45
SHOWPIC.PAS995.00 B07-11-93|18:45
SVGA256.BGI6.19 kB07-11-93|18:45
UNCHAIN.ASM11.60 kB07-11-93|18:45
UNCHAIN.EXE1.20 kB07-11-93|18:45
UNLIB.PAS5.86 kB07-11-93|18:45
WHATSNEW.EXE37.36 kB07-11-93|18:45
WHATSNEW.PAS9.10 kB07-11-93|18:45
...
Sponsored links

GAME.PAS (678.56 kB)

Need 1 point
Your Point(s)

Your Point isn't enough.

Get point immediately by PayPal

More(Debit card / Credit card / PayPal Credit / Online Banking)

Submit your source codes. Get more point

LOGIN

Don't have an account? Register now
Need any help?
Mail to: support@codeforge.com

切换到中文版?

CodeForge Chinese Version
CodeForge English Version

Where are you going?

^_^"Oops ...

Sorry!This guy is mysterious, its blog hasn't been opened, try another, please!
OK

Warm tip!

CodeForge to FavoriteFavorite by Ctrl+D