;_/^^^^^^^^^^^^^\_______________________________________________________________________________________________________
;-[ Information ]------------------------------------------------------------------------------------------------1-2-0--
;^\_____________/^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
; Project Z: One (Opt)
; Created by: TheChange
; Date: 16 Jun 2002
; This is the optimized version of Project Z: One.
; For game information, please run the game, there's an introduction screen with clarification.
; There's also the unoptimized 'Demo' version of this code, which contains lots of comments.
; If you desire to learn how this game works internally, please consult that version first.
; There are many differences between these versions, like the major speed difference.
; Note: This game is resolution dependent (time saving) -> 800x600.
; Include "Lib\Keyboard.BB"
;_/^^^^^^^^^^^^^^^^^^^^^^\______________________________________________________________________________________________
;-[ Key code definitions ]---------------------------------------------------------------------------------------1-2-0--
;^\______________________/^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
;-( Numerical )------------------------------------------;
Const Key1% = 2
Const Key2% = 3
Const Key3% = 4
Const Key4% = 5
Const Key5% = 6
Const Key6% = 7
Const Key7% = 8
Const Key8% = 9
Const Key9% = 10
Const Key0% = 11
Dim KeyNumeric% ( 9 )
KeyNumeric ( 0 ) = Key0
KeyNumeric ( 1 ) = Key1
KeyNumeric ( 2 ) = Key2
KeyNumeric ( 3 ) = Key3
KeyNumeric ( 4 ) = Key4
KeyNumeric ( 5 ) = Key5
KeyNumeric ( 6 ) = Key6
KeyNumeric ( 7 ) = Key7
KeyNumeric ( 8 ) = Key8
KeyNumeric ( 9 ) = Key9
;-( Alphabetic )-----------------------------------------;
Const KeyQ% = 16
Const KeyW% = 17
Const KeyE% = 18
Const KeyR% = 19
Const KeyT% = 20
Const KeyY% = 21
Const KeyU% = 22
Const KeyI% = 23
Const KeyO% = 24
Const KeyP% = 25
Const KeyA% = 30
Const KeyS% = 31
Const KeyD% = 32
Const KeyF% = 33
Const KeyG% = 34
Const KeyH% = 35
Const KeyJ% = 36
Const KeyK% = 37
Const KeyL% = 38
Const KeyZ% = 44
Const KeyX% = 45
Const KeyC% = 46
Const KeyV% = 47
Const KeyB% = 48
Const KeyN% = 49
Const KeyM% = 50
Dim KeyAlpha% ( 26 )
KeyAlpha ( 1 ) = KeyA
KeyAlpha ( 2 ) = KeyB
KeyAlpha ( 3 ) = KeyC
KeyAlpha ( 4 ) = KeyD
KeyAlpha ( 5 ) = KeyE
KeyAlpha ( 6 ) = KeyF
KeyAlpha ( 7 ) = KeyG
KeyAlpha ( 8 ) = KeyH
KeyAlpha ( 9 ) = KeyI
KeyAlpha ( 10 ) = KeyJ
KeyAlpha ( 11 ) = KeyK
KeyAlpha ( 12 ) = KeyL
KeyAlpha ( 13 ) = KeyM
KeyAlpha ( 14 ) = KeyN
KeyAlpha ( 15 ) = KeyO
KeyAlpha ( 16 ) = KeyP
KeyAlpha ( 17 ) = KeyQ
KeyAlpha ( 18 ) = KeyR
KeyAlpha ( 19 ) = KeyS
KeyAlpha ( 20 ) = KeyT
KeyAlpha ( 21 ) = KeyU
KeyAlpha ( 22 ) = KeyV
KeyAlpha ( 23 ) = KeyW
KeyAlpha ( 24 ) = KeyX
KeyAlpha ( 25 ) = KeyY
KeyAlpha ( 26 ) = KeyZ
;-( Numeric keypad )-------------------------------------;
Const KeyPad7% = 71
Const KeyPad8% = 72
Const KeyPad9% = 73
Const KeyPad4% = 75
Const KeyPad5% = 76
Const KeyPad6% = 77
Const KeyPad1% = 79
Const KeyPad2% = 80
Const KeyPad3% = 81
Const KeyPad0% = 82
Dim KeyPadNumeric% ( 9 )
KeyPadNumeric ( 0 ) = KeyPad0
KeyPadNumeric ( 1 ) = KeyPad1
KeyPadNumeric ( 2 ) = KeyPad2
KeyPadNumeric ( 3 ) = KeyPad3
KeyPadNumeric ( 4 ) = KeyPad4
KeyPadNumeric ( 5 ) = KeyPad5
KeyPadNumeric ( 6 ) = KeyPad6
KeyPadNumeric ( 7 ) = KeyPad7
KeyPadNumeric ( 8 ) = KeyPad8
KeyPadNumeric ( 9 ) = KeyPad9
;-( Function keys )--------------------------------------;
Const KeyFunction1% = 59
Const KeyFunction2% = 60
Const KeyFunction3% = 61
Const KeyFunction4% = 62
Const KeyFunction5% = 63
Const KeyFunction6% = 64
Const KeyFunction7% = 65
Const KeyFunction8% = 66
Const KeyFunction9% = 67
Const KeyFunction10% = 68
Const KeyFunction11% = 87
Const KeyFunction12% = 88
Dim KeyFunction% ( 12 )
KeyFunction ( 1 ) = KeyFunction1
KeyFunction ( 2 ) = KeyFunction2
KeyFunction ( 3 ) = KeyFunction3
KeyFunction ( 4 ) = KeyFunction4
KeyFunction ( 5 ) = KeyFunction5
KeyFunction ( 6 ) = KeyFunction6
KeyFunction ( 7 ) = KeyFunction7
KeyFunction ( 8 ) = KeyFunction8
KeyFunction ( 9 ) = KeyFunction9
KeyFunction ( 10 ) = KeyFunction10
KeyFunction ( 11 ) = KeyFunction11
KeyFunction ( 12 ) = KeyFunction12
;-( Shiftstate )-----------------------------------------;
Const KeyLeftShift% = 42
Const KeyRightShift% = 54
Const KeyLeftAlt% = 56
Const KeyRightAlt% = 184
Const KeyLeftCtrl% = 29
Const KeyRightCtrl% = 157
Const KeyCapsLock% = 58
Const KeyNumLock% = 69 ; Disfunctional
Const KeyScrollLock% = 70
Const KeyLeftAlternate% = 56
Const KeyRightAlternate% = 184
Const KeyLeftControl% = 29
Const KeyRightControl% = 157
;-( Control keys )---------------------------------------;
Const KeySpace% = 57
Const KeyEnter% = 28
Const KeyTab% = 15
Const KeyBackSpace% = 14
Const KeyInsert% = 210
Const KeyDelete% = 211
Const KeyHome% = 199
Const KeyEnd% = 207
Const KeyPageUp% = 201
Const KeyPageDown% = 209
Const KeyEscape% = 1
Const KeyPause% = 197 ; Numlock
Const KeyLeftWindows% = 219
Const KeyRightWindows% = 220
Const KeyApps% = 221
Const KeyPower% = 222
Const KeySleep% = 223
Const KeyWake% = 227
;-( Signs )----------------------------------------------;
Const KeyBackQuote% = 41
Const KeyMinus% = 12
Const KeyEquals% = 13
Const KeyLeftBracket% = 26
Const KeyRightBracket% = 27
Const KeyBackSlash% = 43
Const KeySemiColon% = 39
Const KeyQuote% = 40
Const KeyComma% = 51
Const KeyPeriod% = 52
Const KeySlash% = 53
;-( Keypad controls )------------------------------------;
Const KeyPadSlash% = 181
Const KeyPadAsterisk% = 55
Const KeyPadMinus% = 74
Const KeyPadPlus% = 78
Const KeyPadEnter% = 156
Const KeyPadPeriod% = 83
;-( Cursors )--------------------------------------------;
Const KeyCursorUp% = 200
Const KeyCursorDown% = 208
Const KeyCursorLeft% = 203
Const KeyCursorRight% = 205
;_/^^^^^^^^^^^^^^^^^^^^^^\______________________________________________________________________________________________
;-[ Key name definitions ]---------------------------------------------------------------------------------------1-2-0--
;^\______________________/^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Dim KeyName$ ( 255 )
;-( Numerical )------------------------------------------;
KeyName ( Key1 ) = "1"
KeyName ( Key2 ) = "2"
KeyName ( Key3 ) = "3"
KeyName ( Key4 ) = "4"
KeyName ( Key5 ) = "5"
KeyName ( Key6 ) = "6"
KeyName ( Key7 ) = "7"
KeyName ( Key8 ) = "8"
KeyName ( Key9 ) = "9"
KeyName ( Key0 ) = "0"
;-( Alphabetic )-----------------------------------------;
KeyName ( KeyQ ) = "Q"
KeyName ( KeyW ) = "W"
KeyName ( KeyE ) = "E"
KeyName ( KeyR ) = "R"
KeyName ( KeyT ) = "T"
KeyName ( KeyY ) = "Y"
KeyName ( KeyU ) = "U"
KeyName ( KeyI ) = "I"
KeyName ( KeyO ) = "O"
KeyName ( KeyP ) = "P"
KeyName ( KeyA ) = "A"
KeyName ( KeyS ) = "S"
KeyName ( KeyD ) = "D"
KeyName ( KeyF ) = "F"
KeyName ( KeyG ) = "G"
KeyName ( KeyH ) = "H"
KeyName ( KeyJ ) = "J"
KeyName ( KeyK ) = "K"
KeyName ( KeyL ) = "L"
KeyName ( KeyZ ) = "Z"
KeyName ( KeyX ) = "X"
KeyName ( KeyC ) = "C"
KeyName ( KeyV ) = "V"
KeyName ( KeyB ) = "B"
KeyName ( KeyN ) = "N"
KeyName ( KeyM ) = "M"
;-( Numeric keypad )-------------------------------------;
KeyName ( KeyPad7 ) = "Pad 7"
KeyName ( KeyPad8 ) = "Pad 8"
KeyName ( KeyPad9 ) = "Pad 9"
KeyName ( KeyPad4 ) = "Pad 4"
KeyName ( KeyPad5 ) = "Pad 5"
KeyName ( KeyPad6 ) = "Pad 6"
KeyName ( KeyPad1 ) = "Pad 1"
KeyName ( KeyPad2 ) = "Pad 2"
KeyName ( KeyPad3 ) = "Pad 3"
KeyName ( KeyPad0 ) = "Pad 0"
;-( Function keys )--------------------------------------;
KeyName ( KeyFunction1 ) = "F1"
KeyName ( KeyFunction2 ) = "F2"
KeyName ( KeyFunction3 ) = "F3"
KeyName ( KeyFunction4 ) = "F4"
KeyName ( KeyFunction5 ) = "F5"
KeyName ( KeyFunction6 ) = "F6"
KeyName ( KeyFunction7 ) = "F7"
KeyName ( KeyFunction8 ) = "F8"
KeyName ( KeyFunction9 ) = "F9"
KeyName ( KeyFunction10 ) = "F10"
KeyName ( KeyFunction11 ) = "F11"
KeyName ( KeyFunction12 ) = "F12"
;-( Shiftstate )-----------------------------------------;
KeyName ( KeyLeftShift ) = "Left Shift"
KeyName ( KeyRightShift ) = "Right Shift"
KeyName ( KeyLeftAlt ) = "Left Alt"
KeyName ( KeyRightAlt ) = "Right Alt"
KeyName ( KeyLeftCtrl ) = "Left Control"
KeyName ( KeyRightCtrl ) = "Right Control"
KeyName ( KeyCapsLock ) = "CapsLock"
KeyName ( KeyNumLock ) = "NumLock"
KeyName ( KeyScrollLock ) = "ScrollLock"
;-( Control keys )---------------------------------------;
KeyName ( KeySpace ) = "SpaceBar"
KeyName ( KeyEnter ) = "Enter"
KeyName ( KeyTab ) = "Tab"
KeyName ( KeyBackSpace ) = "BackSpace"
KeyName ( KeyInsert ) = "Insert"
KeyName ( KeyDelete ) = "Delete"
KeyName ( KeyHome ) = "Home"
KeyName ( KeyEnd ) = "End"
KeyName ( KeyPageUp ) = "PageUp"
KeyName ( KeyPageDown ) = "PageDown"
KeyName ( KeyEscape ) = "Escape"
KeyName ( KeyPause ) = "Pause"
KeyName ( KeyLeftWindows ) = "Left Windows"
KeyName ( KeyRightWindows ) = "Right Windows"
KeyName ( KeyApps ) = "Apps"
KeyName ( KeyPower ) = "Power"
KeyName ( KeySleep ) = "Sleep"
KeyName ( KeyWake ) = "Wake"
;-( Signs )----------------------------------------------;
KeyName ( KeyBackQuote ) = "BackQuote"
KeyName ( KeyMinus ) = "Minus"
KeyName ( KeyEquals ) = "Equals"
KeyName ( KeyLeftBracket ) = "Left Bracket"
KeyName ( KeyRightBracket ) = "Right Bracket"
KeyName ( KeyBackSlash ) = "BackSlash"
KeyName ( KeySemiColon ) = "SemiColon"
KeyName ( KeyQuote ) = "Quote"
KeyName ( KeyComma ) = "Comma"
KeyName ( KeyPeriod ) = "Period"
KeyName ( KeySlash ) = "Slash"
;-( Keypad controls )------------------------------------;
KeyName ( KeyPadSlash ) = "Pad Slash"
KeyName ( KeyPadAsterisk ) = "Pad Asterisk"
KeyName ( KeyPadMinus ) = "Pad Minus"
KeyName ( KeyPadPlus ) = "Pad Plus"
KeyName ( KeyPadEnter ) = "Pad Enter"
KeyName ( KeyPadPeriod ) = "Pad Period"
;-( Cursors )--------------------------------------------;
KeyName ( KeyCursorUp ) = "Cursor Up"
KeyName ( KeyCursorDown ) = "Cursor Down"
KeyName ( KeyCursorLeft ) = "Cursor Left"
KeyName ( KeyCursorRight ) = "Cursor Right"
;_/^^^^^^^^^^^^^^^^^^^^\________________________________________________________________________________________________
;-[ Key initialization ]-----------------------------------------------------------------------------------------1-2-0--
;^\____________________/^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FlushKeys ()
;-->
; Include "Lib\Vector.BB"
; *------------------------------------*
; | |
; | Vector Matrix Conversion - VXII |
; | |
; *------------------------------------*
;-[ Sub ]--------------------------------------------------------------------------------------------------------1-2-0--
Function GetVectorX# ( Distance# , Angle# ) ; Get horizontal size of vector using distance and angle.
Return Sin ( Angle ) * Distance
End Function
Function GetVectorY# ( Distance# , Angle# ) ; Get vertical size of vector using distance and angle.
Return Sin ( Angle - 90 ) * Distance
End Function
;<--
Function GetLength# ( X# , Y# ) ; Get true length of a vector (not used in this game).
Return Sqr ( X * X + Y * Y )
End Function
Function GetAngle% ( X# , Y# ) ; Get true angle of a vector.
Result% = ATan2 ( Y , X ) + 90
If Result < 0 Result = Result + 360
Return Result
End Function
;-->
If Not GfxModeExists ( 800 , 600 , 16 )
e1$ = "I'm sorry, "
e2$ = "your graphics card does not support "
e3$ = "the required graphics mode: "
e4$ = "800 x 600. "
RuntimeError e1$ + e2$ + e3$ + e4$
EndIf
Graphics 800 , 600
ClsColor 0 , 0 , 0
Color 255 , 255 , 255
Print "Starting up manually..."
SmallFont = LoadFont ( "Blitz" )
Font = LoadFont ( "Blitz" , 20 , True )
SetFont Font
PlayerBitmap = CreateImage ( 32 , 32 )
MidHandle PlayerBitmap
SetBuffer ImageBuffer ( PlayerBitmap )
Color 0 , 63 , 127
Oval 0 , 0 , 32 , 32 , False
Color 0 , 127 , 191
Oval 3 , 3 , 26 , 26 , False
Color 0 , 95 , 159
Oval 6 , 6 , 20 , 20 , True
Color 0 , 0 , 0
Oval 11 , 11 , 10 , 10 , True
Color 159 , 159 , 159
Oval 12 , 12 , 8 , 8 , False
Color 255 , 255 , 255
Oval 14 , 14 , 4 , 4 , True
PlayerX = 400
PlayerY = 300
TargetBitmap = CreateImage ( 15 , 15 )
MidHandle TargetBitmap
SetBuffer ImageBuffer ( TargetBitmap )
Color 255 , 0 , 0
Oval 0 , 0 , 15 , 15 , False
Plot 7 , 7
EnemyBitmap = CreateImage ( 25 , 25 )
MidHandle EnemyBitmap
SetBuffer ImageBuffer ( EnemyBitmap )
Color 95 , 127 , 0
Rect 0 , 0 , 25 , 25 , False
Color 191 , 255 , 0
Oval 2 , 2 , 10 , 10 , False
Oval 2 , 13 , 10 , 10 , False
Oval 13 , 2 , 10 , 10 , False
Oval 13 , 13 , 10 , 10 , False
Type Enemy
Field X#
Field Y#
Field Class
End Type
Local Enemy.Enemy
BulletBitmap = CreateImage ( 3 , 3 )
MidHandle BulletBitmap
SetBuffer ImageBuffer ( BulletBitmap )
Color 255 , 255 , 255
Plot 1 , 1
Color 127 , 127 , 127
Plot 0 , 1
Plot 1 , 0
Plot 2 , 1
Plot 1 , 2
Color 63 , 63 , 63
Plot 0 , 0
Plot 0 , 2
Plot 2 , 0
Plot 2 , 2
Type Bullet
Field Owner ; 1 for Player , 2 for Enemy
Field X#
Field Y#
Field Angle#
End Type
Local Bullet.Bullet
ShrapnelBitmap = CreateImage ( 12 , 12 )
MidHandle ShrapnelBitmap
SetBuffer ImageBuffer ( ShrapnelBitmap )
Color 95 , 127 , 0
Oval 0 , 0 , 12 , 12 , False
Color 191 , 255 , 0
Oval 2 , 2 , 8 , 8 , False
Type Shrapnel
Field X#
Field Y#
Field Angle#
Field Distance
Field TotalDistance
End Type
Local Shrapnel.Shrapnel
SeedRnd MilliSecs ()
Timer = CreateTimer ( 60 )
FrameLimit = True
MaxEnemy = 25
HighScore = 1000000
;-------------------------------------------------------------------------------
Repeat
;-------------------------------------------------------------------------------
Score = 0
SpawningTime# = 100
Level = 0
BulletCost = 1
ShootDelay = 140
EnemyClass = 1
EnemySpeed = 1
EnemyShots = 0
EnemyShooting = False
SpawningWait = 0
ShootingWait = 0
Shooting = False
ScoreWait = 0
;-------------------------------------------------------------------------------
InformationBitmap = CreateImage ( 800 , 600 )
SetBuffer ImageBuffer ( InformationBitmap )
Color 0 , 191 , 255
Text 400 , 22 , "Project Z: One" , True , True
SetFont SmallFont
y = 48
Color 0 , 127 , 255
Text 400 , y + 00 , "In this game, you cannot die. Instead, there is another type of agony: Score." , True , True
Text 400 , y + 12 , "The game's primary objective is to beat the HighScore, which you see at the bottom of the screen." , True , True
Text 400 , y + 24 , "This game also contains a secret objective, which can be completed by getting a very high score." , True , True
Text 400 , y + 36 , "These controls are at your disposal:" , True , True
x = 30
y = y + 60
Color 127 , 127 , 127
Rect x + 20 , y - 2 , 20 , 20 , True
Rect x - 2 , y + 20 , 20 , 20 , True
Rect x + 20 , y + 20 , 20 , 20 , True
Rect x + 40 + 2 , y + 20 , 20 , 20 , True
Color 095 , 095 , 095
Rect x + 20 , y - 2 , 20 , 20 , False
Rect x - 2 , y + 20 , 20 , 20 , False
Rect x + 20 , y + 20 , 20 , 20 , False
Rect x + 40 + 2 , y + 20 , 20 , 20 , False
Color 5 , 5 , 5
s = 3
a = x + 20 + 10 -4
b = y - 2 + 10 -7
For i = 0 To s
Line a - i , b + i , a + i , b + i
Next
a = x - 2 + 10 -7
b = y + 20 + 10 -4
For i = 0 To s
Line a + i , b - i , a + i , b + i
Next
a = x + 20 + 10 -4
b = y + 20 + 10 -1
For i = 0 To s
Line a - i , b - i , a + i , b - i
Next
a = x + 40 + 2 + 10 -1
b = y + 20 + 10 -4
For i = 0 To s
Line a - i , b - i , a - i , b + i
Next
a = 140
b = 30
s = 10
e = 40
DrawImage PlayerBitmap , x + a , y + b
Color 0 , 0 , 127
c = x + a
d = y + b - e
For i = 0 To s
Line c - i , d + i , c + i , d + i
Next
c = x + a
d = y + b + e
For i = 0 To s
Line c - i , d - i , c + i , d - i
Next
c = x + a - e
d = y + b
For i = 0 To s
Line c + i , d - i , c + i , d + i
Next
c = x + a + e
d = y + b
For i = 0 To s
Line c - i , d - i , c - i , d + i
Next
tx = 450
Color 0 , 127 , 255
Text tx , y + b , "Use the cursor-keys to move the player." , True , True
s = 8
c = x + a + 90
d = y + b
Color 63 , 63 , 0
For i = 0 To s
Line c + i , d - i , c + i , d + i
Next
y = y + 68
a = 800 - 30 - 30 - 80
Color 127 , 127 , 127
Rect x + a , y - 25 , 20 , 20 , True
Rect x + 25 + a , y , 20 , 20 , True
Rect x + 50 + a , y + 25 , 20 , 20 , True
Color 095 , 095 , 095
Rect x + a , y - 25 , 20 , 20 , False
Rect x + 25 + a , y , 20 , 20 , False
Rect x + 50 + a , y + 25 , 20 , 20 , False
c = x + a + 3
d = y - 25 + 3
Color 5 , 5 , 5
Plot c + 00 , d + 00
Plot c + 00 , d + 01
Plot c + 00 , d + 02
Plot c + 00 , d + 03
Plot c + 00 , d + 04
Plot c + 01 , d + 00
Plot c + 01 , d + 02
Plot c + 01 , d + 04
Plot c + 02 , d + 00
Plot c + 02 , d + 04
;<--
Plot c + 04 , d + 01
Plot c + 04 , d + 04
Plot c + 05 , d + 00
Plot c + 05 , d + 02
Plot c + 05 , d + 04
Plot c + 06 , d + 00
Plot c + 06 , d + 03
;<--
Plot c + 08 , d + 01
Plot c + 08 , d + 02
Plot c + 08 , d + 03
Plot c + 09 , d + 00
Plot c + 09 , d + 04
Plot c + 10 , d + 00
Plot c + 10 , d + 04
c = x + a + 25 + 3
d = y + 3
Plot c + 00 , d + 00
Plot c + 00 , d + 01
Plot c + 00 , d + 02
Plot c + 00 , d + 03
Plot c + 00 , d + 04
Plot c + 01 , d + 00
Plot c + 01 , d + 01
Plot c + 01 , d + 02
Plot c + 01 , d + 03
Plot c + 01 , d + 04
Plot c + 02 , d + 00
Plot c + 02 , d + 02
Plot c + 03 , d + 00
Plot c + 03 , d + 02
Plot c + 04 , d + 00
Plot c + 04 , d + 01
Plot c + 04 , d + 02
Plot c + 05 , d + 01
c = x + a + 50 + 3
d = y + 25 + 3
Plot c + 00 , d + 00
Plot c + 00 , d + 01
Plot c + 00 , d + 02
Plot c + 00 , d + 03
Plot c + 00 , d + 04
Plot c + 01 , d + 00
Plot c + 01 , d + 01
Plot c + 01 , d + 02
Plot c + 01 , d + 03
Plot c + 01 , d + 04
Plot c + 02 , d + 00
Plot c + 02 , d + 02
Plot c + 03 , d + 00
Plot c + 03 , d + 02
Plot c + 04 , d + 00
Plot c + 05 , d + 00
Color 0 , 127 , 255
Text tx , y - 09 , "Press Esc during the game to return here." , True , True
Text tx , y + 03 , "Press P to pause the game." , True , True
Text tx , y + 15 , "And press F to toggle between" , True , True
Text tx , y + 27 , "hardware or software frame-limiting." , True , True
s = 8
c = x + a - 50
d = y + 9
Color 63 , 63 , 0
For i = 0 To s
Line c - i , d - i , c - i , d + i
Next
x = x + 5
y = y + 22
Color 63 , 63 , 63
Rect x , y , 51 , 80 , False
Line x , y + 25 , x + 50 , y + 25
Line x + 25 , y , x + 25 , y + 25
Color 127 , 127 , 127
Rect x + 2 , y + 2 , 22 , 22
Rect x + 27 , y + 2 , 22 , 22
Rect x + 2 , y + 27 , 47 , 51
Color 95 , 95 , 95
Rect x + 2 -1, y + 2 -1, 22 +2, 22 +2, False
Rect x + 27 -1, y + 2 -1, 22 +2, 22 +2, False
Rect x + 2 -1, y + 27 -1, 47 +2, 51 +2, False
a = x
b = y
x = a + 5
y = b + 10
Color 5 , 5 , 5
Plot x + 00 , y + 00
Plot x + 00 , y + 01
Plot x + 00 , y + 02
Plot x + 00 , y + 03
Plot x + 00 , y + 04
Plot x + 01 , y + 00
Plot x + 01 , y + 02
Plot x + 02 , y + 00
;<--
Plot x + 04 , y + 00
Plot x + 04 , y + 04
Plot x + 05 , y + 00
Plot x + 05 , y + 01
Plot x + 05 , y + 02
Plot x + 05 , y + 03
Plot x + 05 , y + 04
Plot x + 06 , y + 00
Plot x + 06 , y + 04
;<--
Plot x + 08 , y + 00
Plot x + 08 , y + 01
Plot x + 08 , y + 02
Plot x + 08 , y + 03
Plot x + 08 , y + 04
Plot x + 09 , y + 00
Plot x + 09 , y + 02
Plot x + 10 , y + 01
Plot x + 10 , y + 03
Plot x + 10 , y + 04
;<--
Plot x + 12 , y + 00
Plot x + 12 , y + 01
Plot x + 12 , y + 02
Plot x + 12 , y + 03
Plot x + 12 , y + 04
Plot x + 13 , y + 00
Plot x + 13 , y + 02
Plot x + 13 , y + 04
Plot x + 14 , y + 00
Plot x + 14 , y + 04
x = a
y = b
a = 25
b = 40
s = 8
e = 45
f = 60
Color 63 , 63 , 63
c = x + a
d = y + b - f
For i = 0 To s
Line c - i , d + i , c + i , d + i
Next
c = x + a
d = y + b + f
For i = 0 To s
Line c - i , d - i , c + i , d - i
Next
c = x + a - e
d = y + b
For i = 0 To s
Line c + i , d - i , c + i , d + i
Next
c = x + a + e
d = y + b
For i = 0 To s
Line c - i , d - i , c - i , d + i
Next
a = 135
b = 40
s = 8
e = 35
DrawImage TargetBitmap , x + a , y + b
Color 95 , 0 , 0
c = x + a
d = y + b - e
For i = 0 To s
Line c - i , d + i , c + i , d + i
Next
c = x + a
d = y + b + e
For i = 0 To s
Line c - i , d - i , c + i , d - i
Next
c = x + a - e
d = y + b
For i = 0 To s
Line c + i , d - i , c + i , d + i
Next
c = x + a + e
d = y + b
For i = 0 To s
Line c - i , d - i , c - i , d + i
Next
Color 0 , 127 , 255
Text tx , y + b - 6 , "Use the mouse to move the target." , True , True
Text tx , y + b + 6 , "Press the primary mouse button to fire." , True , True
s = 8
c = x + a + 90
d = y + b
Color 63 , 63 , 0
For i = 0 To s
Line c + i , d - i , c + i , d + i
Next
x = x + 50
a = 85
y = y + 112
DrawImage EnemyBitmap , x + a , y
s = 8
c = x + a + 10 + ImageWidth ( EnemyBitmap ) / 2
d = y
Color 63 , 63 , 0
For i = 0 To s
Line c + i , d - i , c + i , d + i
Next
Color 0 , 127 , 255
Text tx , y - 12 , "The enemy comes in 5 different flavors." , True , True
Text tx , y + 00 , "Shooting an enemy can give you up to 500 points." , True , True
Text tx , y + 12 , "But when an enemy bumps into you, you lose 1000 points." , True , True
y = y + 66
DrawImage BulletBitmap , x + a , y
s = 8
c = x + a + 10 + ImageWidth ( BulletBitmap ) / 2
d = y
Color 63 , 63 , 0
For i = 0 To s
Line c + i , d - i , c + i , d + i
Next
Color 0 , 127 , 255
Text tx , y - 24 , "Both you and ememies can fire bullets which cost points." , True , True
Text tx , y - 12 , "The higher the firing-rate, the higher the cost." , True , True
Text tx , y + 00 , "The higher the score, the higher the firing-rate." , True , True
Text tx , y + 12 , "An enemy is always instantly killed by a bullet." , True , True
Text tx , y + 24 , "But when a bullet hits you, you lose 100 points." , True , True
y = y + 60
DrawImage ShrapnelBitmap , x + a , y
s = 8
c = x + a + 10 + ImageWidth ( ShrapnelBitmap ) / 2
d = y
Color 63 , 63 , 0
For i = 0 To s
Line c + i , d - i , c + i , d + i
Next
Color 0 , 127 , 255
Text tx , y - 6 , "When you kill an enemy, it leaves behind shrapnel." , True , True
Text tx , y + 6 , "Shrapnel, in this game, is completely harmless." , True , True
y = y + 36
Text 400 , y + 00 , "The game progresses slowly, so you can easily familiarize yourself with the environment." , True , True
Text 400 , y + 12 , "But please be aware that at a certain point in the game, the enemies" , True , True
Text 400 , y + 24 , "will start looking like a green virus from outer space gone mad." , True , True
Text 400 , y + 36 , "At that point you will know you're not inside a dull shooter but a virus wrecking mayhem." , True , True
y = y + 66
Color 127 , 191 , 255
Text 200 , y , "Press Fire to start" , True , True
Text 600 , y , "Press Esc to stop" , True , True
SetFont Font
Color 0 , 127 , 255
Text 200 , 590 , "Score: " + WithComma ( Score ) , True , True
Text 600 , 590 , "High: " + WithComma ( HighScore ) , True , True
Color 47 , 95 , 0
Rect 298 , 594 , 200 + 2 , 6 , False
For Enemies = 1 To MaxEnemy
Enemy = New Enemy
Enemy\X = Int ( Rnd ( 800 ) )
Enemy\Y = Int ( Rnd ( 600 ) )
Enemy\Class = Int ( Rnd ( 360 ) ) ; Class temporarily used as Angle
Next
;-------------------------------------------------------------------------------
SpawnTimer = 0
Shaking# = 20
SetBuffer BackBuffer ()
ExitLoop = False
Repeat
If SpawnTimer < 10
SpawnTimer = SpawnTimer + 1
Else
SpawnTimer = 0
If Enemies > MaxEnemy
Enemy = First Enemy
For x = 0 To 3
Shrapnel = New Shrapnel
Shrapnel\X = Enemy\X
Shrapnel\Y = Enemy\Y
Shrapnel\Angle = x * 90 + Rnd ( 90 )
Shrapnel\Distance = 0
Shrapnel\TotalDistance = 9 + Rnd ( 20 )
Next
Delete Enemy
EndIf
Enemy = New Enemy
Enemy\X = Int ( Rnd ( 800 ) )
Enemy\Y = Int ( Rnd ( 600 ) )
Enemy\Class = Int ( Rnd ( 360 ) )
EndIf
For Enemy = Each Enemy
Enemy\Class = Enemy\Class + Rnd ( -15 , 15 )
Enemy\X = Enemy\X + GetVectorX ( 3 , Enemy\Class ) + GetVectorX ( 2 , Rnd ( 360 ) )
Enemy\Y = Enemy\Y + GetVectorY ( 3 , Enemy\Class ) + GetVectorY ( 2 , Rnd ( 360 ) )
If Enemy\X < 0 Then Enemy\X = Enemy\X + 800
If Enemy\X > 799 Then Enemy\X = Enemy\X - 800
If Enemy\Y < 0 Then Enemy\Y = Enemy\Y + 600
If Enemy\Y > 599 Then Enemy\Y = Enemy\Y - 600
DrawImage EnemyBitmap , Enemy\X , Enemy\Y
Next
For Shrapnel = Each Shrapnel
Shrapnel\X = Shrapnel\X + GetVectorX ( 1 , Shrapnel\Angle )
Shrapnel\Y = Shrapnel\Y + GetVectorY ( 1 , Shrapnel\Angle )
If Shrapnel\Distance >= Shrapnel\TotalDistance
Delete Shrapnel
Shrapnel = After Shrapnel
If Shrapnel = Null Then Exit
Else
Shrapnel\Distance = Shrapnel\Distance + 1
EndIf
If Shrapnel\X < 0 Then Shrapnel\X = Shrapnel\X + 800
If Shrapnel\X > 799 Then Shrapnel\X = Shrapnel\X - 800
If Shrapnel\Y < 0 Then Shrapnel\Y = Shrapnel\Y + 600
If Shrapnel\Y > 599 Then Shrapnel\Y = Shrapnel\Y - 600
DrawImage ShrapnelBitmap , Shrapnel\X , Shrapnel\Y
Next
If Shaking > 0.1
Shaking = Shaking / 1.03
DrawImage InformationBitmap , Rnd ( -Shaking , Shaking ) , Rnd ( -Shaking , Shaking )
Else
Shaking = 0
DrawImage InformationBitmap , Rnd ( -Shaking , Shaking ) , Rnd ( -Shaking , Shaking )
EndIf
Flip True
Cls
If MouseDown ( 1 ) Then ExitLoop = True
If KeyHit ( KeyEscape )
QuitGame = True
ExitLoop = True
EndIf
Until ExitLoop
FreeImage InformationBitmap
;-------------------------------------------------------------------------------
If Not QuitGame
;-------------------------------------------------------------------------------
ClsColor 255 , 255 , 255
Cls
Flip True
ClsColor 0 , 0 , 0
For Enemy = Each Enemy
For x = 0 To 3
Shrapnel = New Shrapnel
Shrapnel\X = Enemy\X
Shrapnel\Y = Enemy\Y
Shrapnel\Angle = x * 90 + Rnd ( 90 )
Shrapnel\Distance = 0
Shrapnel\TotalDistance = 9 + Rnd ( 20 )
Next
Delete Enemy
Next
Enemies = 0
FlushKeys ()
;-------------------------------------------------------------------------------
SetBuffer BackBuffer ()
ExitLoop = False
Repeat
WaitTimer ( Timer )
If Score < 1000
BulletCost = 1
ShootDelay = 140
Level = 0
EnemyClass = 1
EnemySpeed = 1
ElseIf Score < 2000
BulletCost = 1
ShootDelay = 120
EnemySpeed = 2
EnemyShooting = True
EnemyShots = 1
ElseIf Score < 4000
BulletCost = 1
ShootDelay = 100
EnemyShots = 2
ElseIf Score < 6000
BulletCost = 1
ShootDelay = 80
EnemyShots = 5
ElseIf Score < 8000
EnemyShots = 10
ElseIf Score < 10000
BulletCost = 2
ShootDelay = 60
Level = 1
EnemyClass = 2
ElseIf Score < 20000
BulletCost = 3
ShootDelay = 40
Level = 2
EnemySpeed = 3
ElseIf Score < 30000
BulletCost = 4
ShootDelay = 24
EnemyClass = 3
ElseIf Score < 40000
BulletCost = 5
ShootDelay = 12
EnemyShots = 20
ElseIf Score < 60000
BulletCost = 6
ShootDelay = 6
Level = 3
EnemyClass = 4
ElseIf Score < 80000
EnemyShots = 50
ElseIf Score < 100000
BulletCost = 12
ShootDelay = 4
Level = 4
EnemyClass = 5
ElseIf Score < 200000
BulletCost = 24
ShootDelay = 2
Level = 5
ElseIf Score < 300000
EnemyShots = 100
ElseIf Score < 400000
BulletCost = 48
ShootDelay = 1
Level = 6
ElseIf Score < 500000
BulletCost = 96
ShootDelay = 0
Level = 7
EnemySpeed = 4
ElseIf Score < 600000
EnemyShots = 200
ElseIf Score < 700000
Level = 8
EnemySpeed = 6
ElseIf Score < 800000
EnemyShots = 300
ElseIf Score < 900000
EnemyShots = 400
ElseIf Score < 1000000
Level = 9
EnemySpeed = 8
EnemyShots = 500
ElseIf Score < 2000000
Level = 10
EnemySpeed = 10
EnemyShots = 1000
Else
BulletCost = 0
Level = 10
GodMode = True
EndIf
If Score > HighScore
HighScore = Score
EndIf
If ScoreWait > 9
ScoreWait = 0
Score = Score + 1
Else
ScoreWait = ScoreWait + 1
EndIf
If Shooting
If ShootingWait >= ShootDelay
Shooting = False
ShootingWait = 0
Else
ShootingWait = ShootingWait + 1
EndIf
Else
If MouseDown ( 1 )
If Score >= BulletCost
Score = Score - BulletCost
Shooting = True
Bullet = New Bullet
Bullet\Owner = 1
Bullet\X = PlayerX
Bullet\Y = PlayerY
Bullet\Angle = GetAngle ( MouseX () - PlayerX , MouseY () - PlayerY )
EndIf
EndIf
EndIf
If SpawningTime > 1
SpawningTime = SpawningTime / 1.00015
EndIf
If SpawningWait > SpawningTime
SpawningWait = 0
If Enemies >= MaxEnemy
Enemy = First Enemy
For x = 0 To 3
Shrapnel = New Shrapnel
Shrapnel\X = Enemy\X
Shrapnel\Y = Enemy\Y
Shrapnel\Angle = x * 90 + Rnd ( 90 )
Shrapnel\Distance = 0
Shrapnel\TotalDistance = 9 + Rnd ( 20 )
Next
Delete Enemy
Enemies = Enemies - 1
EndIf
Repeat
x = Rnd ( 800 )
y = Rnd ( 600 )
Until Not ( x > PlayerX - 149 ) And ( x < PlayerX + 149 ) And ( y > PlayerY - 149 ) And ( y < PlayerY + 149 )
Enemy = New Enemy
Enemies = Enemies + 1
Enemy\X = x
Enemy\Y = y
Enemy\Class = Rnd ( 1 , EnemyClass )
Else
SpawningWait = SpawningWait + 1
EndIf
If KeyDown ( KeyCursorUp )
PlayerY = PlayerY - 2
MovementY = True
EndIf
If KeyDown ( KeyCursorDown )
PlayerY = PlayerY + 2
MovementY = True
EndIf
If KeyDown ( KeyCursorLeft )
PlayerX = PlayerX - 2
MovementX = True
EndIf
If KeyDown ( KeyCursorRight )
PlayerX = PlayerX + 2
MovementX = True
EndIf
If MovementY
MovementY = False
If PlayerY < 0 Then PlayerY = 0
If PlayerY > 599 Then PlayerY = 599
EndIf
If MovementX
MovementX = False
If PlayerX < 0 Then PlayerX = 0
If PlayerX > 799 Then PlayerX = 799
EndIf
For Shrapnel = Each Shrapnel
Shrapnel\X = Shrapnel\X + GetVectorX ( 1 , Shrapnel\Angle )
Shrapnel\Y = Shrapnel\Y + GetVectorY ( 1 , Shrapnel\Angle )
If Shrapnel\Distance >= Shrapnel\TotalDistance
Delete Shrapnel
Shrapnel = After Shrapnel
If Shrapnel = Null Then Exit
Else
Shrapnel\Distance = Shrapnel\Distance + 1
If ( Shrapnel\X < 0 ) Or ( Shrapnel\X > 799 ) Or ( Shrapnel\Y < 0 ) Or ( Shrapnel\Y > 599 )
Delete Shrapnel
Shrapnel = After Shrapnel
If Shrapnel = Null Then Exit
EndIf
EndIf
DrawImage ShrapnelBitmap , Shrapnel\X , Shrapnel\Y
Next
For Enemy = Each Enemy
x = Rnd ( -1 , 1 )
y = Rnd ( -1 , 1 )
Select Enemy\Class
Case 1
If EnemyShooting
If Int ( Rnd ( 10000 / EnemyShots ) ) = 0
Blt.Bullet = New Bullet
Blt\Owner = 2
Blt\X = Enemy\X
Blt\Y = Enemy\Y
Blt\Angle = GetAngle ( PlayerX - Enemy\X , PlayerY - Enemy\Y ) + Rnd ( -5 , 5 )
If Blt\Angle < 0 Then Blt\Angle = Blt\Angle + 360
If Blt\Angle > 359 Then Blt\Angle = Blt\Angle - 360
EndIf
EndIf
Enemy\X = Enemy\X + x * EnemySpeed
Enemy\Y = Enemy\Y + y * EnemySpeed
Case 2
If EnemyShooting
If Int ( Rnd ( 20000 / EnemyShots ) ) = 0
Blt.Bullet = New Bullet
Blt\Owner = 2
Blt\X = Enemy\X
Blt\Y = Enemy\Y
Blt\Angle = GetAngle ( PlayerX - Enemy\X , PlayerY - Enemy\Y ) + Rnd ( -10 , 10 )
If Blt\Angle < 0 Then Blt\Angle = Blt\Angle + 360
If Blt\Angle > 359 Then Blt\Angle = Blt\Angle - 360
EndIf
EndIf
z = EnemySpeed/2
Enemy\X = Enemy\X + x * z
Enemy\Y = Enemy\Y + y * z
If MouseX () > Enemy\X Then Enemy\X = Enemy\X - z
If MouseX () < Enemy\X Then Enemy\X = Enemy\X + z
If MouseY () > Enemy\Y Then Enemy\Y = Enemy\Y - z
If MouseY () < Enemy\Y Then Enemy\Y = Enemy\Y + z
Case 3
If EnemyShooting
If Int ( Rnd ( 30000 / EnemyShots ) ) = 0
Blt.Bullet = New Bullet
Blt\Owner = 2
Blt\X = Enemy\X
Blt\Y = Enemy\Y
Blt\Angle = GetAngle ( PlayerX - Enemy\X , PlayerY - Enemy\Y ) + Rnd ( -15 , 15 )
If Blt\Angle < 0 Then Blt\Angle = Blt\Angle + 360
If Blt\Angle > 359 Then Blt\Angle = Blt\Angle - 360
EndIf
EndIf
z = EnemySpeed/3
Enemy\X = Enemy\X + x * z
Enemy\Y = Enemy\Y + y * z
If PlayerX < Enemy\X Then Enemy\X = Enemy\X - z
If PlayerX > Enemy\X Then Enemy\X = Enemy\X + z
If PlayerY < Enemy\Y Then Enemy\Y = Enemy\Y - z
If PlayerY > Enemy\Y Then Enemy\Y = Enemy\Y + z
If MouseX () > Enemy\X Then Enemy\X = Enemy\X - z
If MouseX () < Enemy\X Then Enemy\X = Enemy\X + z
If MouseY () > Enemy\Y Then Enemy\Y = Enemy\Y - z
If MouseY () < Enemy\Y Then Enemy\Y = Enemy\Y + z
Case 4
z = EnemySpeed/2
Enemy\X = Enemy\X + x * z
Enemy\Y = Enemy\Y + y * z
If PlayerX < Enemy\X Then Enemy\X = Enemy\X - z
If PlayerX > Enemy\X Then Enemy\X = Enemy\X + z
If PlayerY < Enemy\Y Then Enemy\Y = Enemy\Y - z
If PlayerY > Enemy\Y Then Enemy\Y = Enemy\Y + z
Case 5
z = EnemySpeed/2
a = GetAngle ( PlayerX - Enemy\X , PlayerY - Enemy\Y )
Enemy\X = Enemy\X + GetVectorX ( z , a ) + GetVectorX ( z , x*180+180 )
Enemy\Y = Enemy\Y + GetVectorY ( z , a ) + GetVectorY ( z , y*180+180 )
End Select
If Enemy\X < 0 Then Enemy\X = 0
If Enemy\X > 799 Then Enemy\X = 799
If Enemy\Y < 0 Then Enemy\Y = 0
If Enemy\Y > 599 Then Enemy\Y = 599
If ImagesOverlap ( EnemyBitmap , Enemy\X , Enemy\Y , PlayerBitmap , PlayerX , PlayerY )
If ImagesCollide ( EnemyBitmap , Enemy\X , Enemy\Y , 0 , PlayerBitmap , PlayerX , PlayerY , 0 )
For x = 0 To 3
Shrapnel = New Shrapnel
Shrapnel\X = Enemy\X
Shrapnel\Y = Enemy\Y
Shrapnel\Angle = x * 90 + Rnd ( 90 )
Shrapnel\Distance = 0
Shrapnel\TotalDistance = 9 + Rnd ( 20 )
Next
Delete Enemy
Enemies = Enemies - 1
If Not GodMode Then Score = Score - 1000
Enemy = After Enemy
If Enemy = Null Then Exit
EndIf
EndIf
DrawImage EnemyBitmap , Enemy\X , Enemy\Y
For Bullet = Each Bullet
If Bullet\Owner = 1
If ImagesOverlap ( EnemyBitmap , Enemy\X , Enemy\Y , BulletBitmap , Bullet\X , Bullet\Y )
If ImagesCollide ( EnemyBitmap , Enemy\X , Enemy\Y , 0 , BulletBitmap , Bullet\X , Bullet\Y , 0 )
Score = Score + ( 100 * Enemy\Class )
If EnemyShooting
Select Enemy\Class
Case 1
Score = Score + 300
Case 2
Score = Score + 200
Case 3
Score = Score + 100
End Select
EndIf
For x = 0 To 3
Shrapnel = New Shrapnel
Shrapnel\X = Enemy\X
Shrapnel\Y = Enemy\Y
Shrapnel\Angle = x * 90 + Rnd ( 90 )
Shrapnel\Distance = 0
Shrapnel\TotalDistance = 9 + Rnd ( 20 )
Next
Delete Bullet
Delete Enemy
Enemies = Enemies - 1
Exit
EndIf
EndIf
EndIf
Next
Next
For Bullet = Each Bullet
Bullet\X = Bullet\X + GetVectorX ( 5 , Bullet\Angle )
Bullet\Y = Bullet\Y + GetVectorY ( 5 , Bullet\Angle )
If ( Bullet\X < 0 ) Or ( BulletX > 799 ) Or ( Bullet\Y < 0 ) Or ( Bullet\Y > 599 )
Delete Bullet
Bullet = After Bullet
If Bullet = Null Then Exit
EndIf
If Bullet\Owner = 2
If ImagesOverlap ( PlayerBitmap , PlayerX , PlayerY , BulletBitmap , Bullet\X , Bullet\Y )
If ImagesCollide ( PlayerBitmap , PlayerX , PlayerY , 0 , BulletBitmap , Bullet\X , Bullet\Y , 0 )
Delete Bullet
If Not GodMode Then Score = Score - 100
Bullet = After Bullet
If Bullet = Null Then Exit
EndIf
EndIf
EndIf
DrawImage BulletBitmap , Bullet\X , Bullet\Y
Next
If Score < 0 Then Score = 0
DrawImage PlayerBitmap , PlayerX , PlayerY
DrawImage TargetBitmap , MouseX () , MouseY ()
Color 0 , 127 , 255
Text 200 , 590 , "Score: " + WithComma ( Score ) , True , True
Text 600 , 590 , "High: " + WithComma ( HighScore ) , True , True
If Not GodMode
Color 255 , 0 , 0
Else
Color 255 , 191 , 0
EndIf
Text 400 , 590 , String ( "¤" , Level ) , True , True
Color 63 , 127 , 0
Rect 300 , 596 , ( 100 - SpawningTime ) * 2 , 2 , False
Color 47 , 95 , 0
Rect 298 , 594 , 200 + 2 , 6 , False
If ShootDelay > 40
If Shooting
Color 63 , 127 , 0
Rect 10 , 10 , ShootingWait * 780 / ShootDelay , 10 , True
Color 47 , 95 , 0
Rect 8 , 8 , 780 + 4 , 14 , False
Color 95 , 191 , 0
Text 400 , 15 , "RECHARGING" , True , True
EndIf
EndIf
If FrameLimit Then
Flip True
Else
Flip False
EndIf
Cls
If KeyHit ( KeyF )
FrameLimit = Not FrameLimit
EndIf
If KeyHit ( KeyP )
SetBuffer FrontBuffer ()
Color 0 , 63 , 127
Rect 400 - 100 - 2 , 300 - 30 - 2 , 100 * 2 + 4 , 30 * 2 + 4 , False
Color 0 , 47 , 95
Rect 400 - 100 , 300 - 30 , 100 * 2 , 30 * 2 , True
Color 0 , 127 , 255
Text 400 , 300 , "PAUSED" , True , True
SetBuffer BackBuffer ()
Repeat
Until KeyHit ( KeyP )
FlushKeys ()
EndIf
If KeyHit ( KeyEscape )
ExitLoop = True
EndIf
Until ExitLoop
Delete Each Bullet
;-------------------------------------------------------------------------------
EndIf
;-------------------------------------------------------------------------------
Until QuitGame
Delete Each Shrapnel
Delete Each Bullet
Delete Each Enemy
FreeImage ShrapnelBitmap
FreeImage BulletBitmap
FreeImage EnemyBitmap
FreeImage PlayerBitmap
FreeFont Font
FreeFont SmallFont
FreeTimer Timer
EndGraphics
Color 255 , 255 , 255
Print "Shutting down automatically..."
End
;-------------------------------------------------------------------------------
Function WithComma$ ( Number$ )
Local Reverse$
Local Comma$
For x = 1 To Len ( Number )
Reverse = Reverse + Mid ( Number , Len ( Number ) - x + 1 , 1 )
Counter = Counter + 1
If Counter = 3
Counter = 0
Reverse = Reverse + ","
EndIf
Next
For x = 1 To Len ( Reverse )
Comma = Comma + Mid ( Reverse , Len ( Reverse ) - x + 1 , 1 )
Next
If Left ( Comma , 1 ) = "," Then Comma = Mid ( Comma , 2 , Len ( Comma ) - 1 )
Return Comma
End Function
;-------------------------------------------------------------------------------
               (
geocities.com/thechange)