var\r
I: word;\r
begin\r
- S.X := Random( 320 ); /* Initialize position with random values */\r
- S.Y := Random( 240 );\r
- S.DX := Random( 7 )-3; /* Initialize speed with random values */\r
- S.DY := Random( 7 )-3;\r
- S.W := 16; /* Size is fixed in this program */\r
- S.H := 16;\r
+ S.X = Random( 320 ); /* Initialize position with random values */\r
+ S.Y = Random( 240 );\r
+ S.DX = Random( 7 )-3; /* Initialize speed with random values */\r
+ S.DY = Random( 7 )-3;\r
+ S.W = 16; /* Size is fixed in this program */\r
+ S.H = 16;\r
/* The image is a square with a hole inside */\r
FillChar( S.Image, SizeOf(S.Image), Random(15)+1 );\r
- for I:=5 to 12 do FillChar( S.Image[ I, 5 ], 8, 0 );\r
+ for I=5 to 12 do FillChar( S.Image[ I, 5 ], 8, 0 );\r
}\r
\r
/* Moves a sprite */\r
Inc( S.Y, S.DY );\r
/* Check sprite position, change delta if needed */\r
if( S.X > 320 ) then begin\r
- S.X := 320;\r
- S.DX := -S.DX;\r
+ S.X = 320;\r
+ S.DX = -S.DX;\r
}\r
if( S.X < -16 ) then begin\r
- S.X := -16;\r
- S.DX := -S.DX;\r
+ S.X = -16;\r
+ S.DX = -S.DX;\r
}\r
if( S.Y > 240 ) then begin\r
- S.Y := 240;\r
- S.DY := -S.DY;\r
+ S.Y = 240;\r
+ S.DY = -S.DY;\r
}\r
if( S.Y < -16 ) then begin\r
- S.Y := -16;\r
- S.DY := -S.DY;\r
+ S.Y = -16;\r
+ S.DY = -S.DY;\r
}\r
/* Draw the sprite, note the Page offset added to the */\r
/* Y coordinate of the image */\r
}\r
\r
/* Compute and set palette */\r
- for I:=1 to 192 do with Palette[I+63] do begin\r
- R := 0;\r
- G := 0;\r
- B := 0;\r
- if( I < 64 ) then\r
- R := I shr 1+31\r
+ for(i=1;i<= 192;Palette[i+63])\r
+ {\r
+ short R = 0;\r
+ short G = 0;\r
+ short B = 0;\r
+ if( i < 64 )\r
+ R = i shr 1+31\r
else if( i < 128 )\r
- G := (I-64) shr 1+31\r
+ G = (i-64) shr 1+31\r
else\r
- B := (I-128) shr 1+31;\r
+ B = (i-128) shr 1+31;\r
}\r
mxSetPalette( @Palette[64], 64, 192 );\r
\r
/* Main loop */\r
- Page := 240;\r
+ short Page = 240;\r
while(!kbhit())\r
{\r
/* Set clip region to current page */\r
/* Restore background */\r
mxBitBlt( 0, 480, 320, 240, 0, Page );\r
/* Draw sprites */\r
- for I:=1 to MAX_SPRITE do sxMove( S[I] );\r
+ for(i=1; i <= MAX_SPRITE; sxMove( S[i] ));\r
/* Print message */\r
mxOutStr( 4, Page+4, 'Some sprites moving...' );\r
/* Flip page */\r
mxStartLine( Page );\r
- Page := 240-Page;\r
+ Page = 240-Page;\r
/* Animate palette */\r
mxSetPalette( @Palette[64], 64, 192 );\r
mxRotatePalette( @Palette[64], 192, 3 );\r