home *** CD-ROM | disk | FTP | other *** search
/ PC Format (UK) 124 / pcfcd124-a.iso / Trial Software / BlitzBasic / Rift2001-05-16 / Rift2 / tutorial2b-complete.bb < prev    next >
Encoding:
Text File  |  2001-05-16  |  19.1 KB  |  379 lines

  1. AppTitle "Celestial Rift - Version 1.1 (C)2001 Myke P" ;what this program will be called in MICROSOFT WINDOWS.
  2.  
  3. ;This makes two CONSTants. These are values which will NOT change at any point in the program, so we set their values now.
  4. Const SCREEN_WIDTH = 800
  5. Const SCREEN_HEIGHT = 600
  6. ;This is the code which tells Blitz what Display Resolution to use on the Graphics Card. The "GRAPHICS" command should always be placed before you do
  7. ;*anything* image-related in your program
  8. Graphics SCREEN_WIDTH,SCREEN_HEIGHT,0,1    ;start the graphics mode at SCREEN_WIDTH by SCREEN_HEIGHT, let Blitz choose the depth (,0) and run full screen (,1)
  9.  
  10. ;more program CONSTants..
  11. Const GAME_AREA_X = 50000    ;these two set the size of the map. You *should* keep them the same, 'cos the radar is square
  12. Const GAME_AREA_Y = 50000    ;but technically, you can change the values to anything you like! ;)
  13. ;the following constants are keyboard "SCAN" codes. Every key on the keyboard has a number. You can get the full list in your Blitz manual.
  14. Const KEY_CLOCKWISE = 25    ;(p)    
  15. Const KEY_ANTICWISE = 24    ;(o)
  16. Const KEY_SPEEDUP = 16        ;(q)
  17. Const KEY_SPEEDDOWN = 30    ;(a)
  18. Const KEY_FIRE = 57            ;(Space)
  19. Const KEY_QUIT = 1            ;(Escape)
  20. Const KEY_PAUSE = 7            ;(Number 6 on the main keyboard)
  21. Const KEY_DEBUG = 59        ;(F1)
  22. Const KEY_SAVESCREEN = 88    ;(F12)
  23. ;the following constants affect the way the game plays. Feel free to mess with the values..
  24. Const INCR_ROTATE# = 5                ;.. but DON'T touch this, otherwise the game will crash (I only drew the animation frames for 5 degree intervals!)
  25. Const INCR_SPEED# = 0.5
  26. Const INCR_SLOW# = 0.125
  27. Const SPEED_MAX = 25
  28. Const SPEED_MIN = -5
  29.  
  30. ;set up changable variables for game/menu (with initial values, if you like - i.e.: you could just as soon as set them later!)
  31. Global FLAG_GAMEON = 1
  32. Global FLAG_PAUSE
  33. Global FLAG_SAVESCREEN = 0
  34. Global FLAG_DEBUG = 0
  35. Global FLAG_GAMESTARTER
  36. Global PLAYER_SHIELD#
  37. Global PLAYER_SPEED#
  38. Global PLAYER_ANGLE#
  39. Global PLAYER_X#
  40. Global PLAYER_Y#
  41. Global PLAYER_SCORE
  42. Global HI_SCORE
  43.  
  44. Global timer
  45. Global frames
  46. Global starson
  47. Global game_pause_frame
  48. Global game_accept_pause
  49. Global game_pause_stat
  50. ;a "#" symbol after the variable name means it can hold a FLOATING POINT number, i.e.: 190.1234
  51. ;without the "#" symbol, the variable is, by default, an INTEGER (Whole) number, i.e.: 190
  52. ;use the symbols when you are *sure* that you want it to hold specific types of data:
  53. ;# - floating point
  54. ;% - integer (whole number)
  55. ;$ - string (text, i.e.: "MYKE 12345"
  56. Global tempstr$
  57.  
  58. timer = CreateTimer(50) ;create a timer set at 50ms (game speed) - play with this to see how you can increase or decrease the speed of the game.
  59.                         ;this should be set at a speed which will look near enough the same on *every* PC it will be played on.
  60.                         ;My PC (a 733MHz PIII with an nVidia GeForce card) will handle upwards of 150 frames per second, quite happily
  61.                         ;but 'lesser' machines will not. 50, therefore, is quite sensible For a game of this nature, who's minimum system spec
  62.                         ;will be something like a PII 300MHz machine (i.e.: Blitz Basic's minimum spec!)
  63.  
  64. ;NOTE: there's no need to organise your variable declarations, as I have here, into sections. They can appear in any order you like, before the main program begins.
  65. ;I just do this, 'cos it looks right professional! :))))
  66.  
  67. ;picture/animation (and related) variables
  68. Dim game_stars(5)            ;these 3 are ARRAYS. An array is automatically Global, but requires the Keyword (Yellow bit) DIM instead. This means "Dimension".
  69. Global game_player
  70. Global game_player_frame
  71. Global game_player_dot
  72. Global game_bullet_player
  73. Global game_gameover
  74. Global game_paused
  75.  
  76. ;Types are like Structures in C. You have a "Type" called whatever. Then you can make multiple versions of the type. Each version of the Type has the same properties, i.e.:
  77. ;a FISH (the Type) has EYES, MOUTH, SCALES And FINS (it's properties) - ALL FISH have these properties.
  78. ;a DOG (the Type) has EYES, MOUTH, FUR and TAIL (it's properties) - ALL DOGS have these properties (look like this.)
  79. Type stars                        ;create "Type" for parallex stars
  80.     Field depth,x#,y#            ;each star has a depth, x and y position
  81. End Type
  82.  
  83. menustars = SCREEN_HEIGHT/3 ;generate a number of stars, so that they look dense enough on all test resolutions
  84. starson = 1 ;tells the program to show the stars (see later)
  85. For i=0 To menustars                    ;create <menustars> number of stars in the STARS type
  86.     star.stars=New stars                ;add a new star for each increment of i
  87. Next
  88.  
  89. ;this code loads the image numbers into an array called "game_ stars", which we DIMmed earlier. It has 6 containers (0,1,2,3,4,5) but I'm only using 1 to 5!
  90. ;an "image number" is what Blitz uses to reference graphics held in the Video Memory, i.e.:
  91. ;1. Image number 12 is a picture of a flower.
  92. ;2. Make a variable called "flower_pic" = 12
  93. ;3. Wherever Blitz is told to draw "flower_pic", reference image number 12 in the Video Memory.
  94. game_stars(1) = LoadImage("GfxRes/backg-star-1.bmp")    ;container (1) in "game_stars" holds the image number for this picture ("GfxRes/backg-star-1.bmp")
  95. game_stars(2) = LoadImage("GfxRes/backg-star-2.bmp")    ;etc..
  96. game_stars(3) = LoadImage("GfxRes/backg-star-3.bmp")
  97. game_stars(4) = LoadImage("GfxRes/backg-star-4.bmp")
  98. game_stars(5) = LoadImage("GfxRes/backg-star-5.bmp")
  99. For i = 1 To 5
  100.     MaskImage game_stars(i),255,0,255    ;mask the images for each star, so that MAGENTA (255,0,255) is the transparent colour
  101. Next
  102.  
  103. ;notice in the following code, we're loading (and MASKING) graphics in exactly the same way as before, but into regular variables instead of arrays.
  104. ;this next bit is all animations
  105. game_player = LoadAnimImage("GfxRes/player-ship.bmp",80,80,0,72) ;load in the 'sprite' for the player ship
  106. MaskImage game_player,255,0,255 ;mask the images for the player ship, so that MAGENTA (255,0,255) is the transparent colour
  107. ;these are all plain single-frame pictures
  108. ;game piccies
  109. game_gameover = LoadImage("GfxRes/game-gameover.bmp")        ;the game over logo, which I tend to see a lot of.. :(
  110. game_paused = LoadImage("GfxRes/game-paused.bmp")            ;the paused logo
  111. game_player_dot = LoadImage("GfxRes/player-radardot.bmp")    ;radar dots for the player and bonus icons respectively
  112. MaskImage game_gameover,255,0,255
  113. MaskImage game_paused,255,0,255
  114.  
  115. ;Right! That's it, we've set up *everything* we're going to need from outside the program. Let's start up the game_loop function..
  116. game_loop()
  117.  
  118. ;this function keeps the game loop going.. It starts playing tunes and sets a couple of variables. 
  119. ;Then it goes into a never ending loop which carries out a sequence of checks and function calls, until such time as we want to stop it!
  120. Function game_loop()
  121.     FLAG_GAMEON = 1 ;tells the program that the game is running.
  122.     game_initialise()     ;calls a function called "game_initialise()" (which is next in the code) which
  123.                         ;just gives the player full energy and a score of 0 etc..)
  124.     Repeat        ;as with the menu, we want to cycle though the process of updating/drawing forever, until such time as the game has ended.
  125.         If FLAG_GAMEON = 1 Then        ;.. so, if FLAG_GAMEON is 1, then "do" the following.
  126.             game_loop_update()                                ;call the game_loop_update() function
  127.         Else
  128.             FlushKeys                
  129.             End                    ;if FLAG_GAMEON isn't 1, we End the program
  130.         End If
  131.     Forever
  132. End Function
  133.  
  134. ;As described a minute ago, this function sets up the game variables as they should be
  135. ;at the start of every game, i.e.: Player Shields are full, the score is 0 etc..
  136. Function game_initialise()
  137.     FLAG_DEBUG = 1                    
  138.     FLAG_GAMESTARTER = 1
  139.     FLAG_PAUSE = 0
  140.     PLAYER_SCORE = 0
  141.     PLAYER_ANGLE = 0
  142.     PLAYER_SPEED = 0
  143.     game_player_randomize()            ;calls a function that randomizes a player's position on the map
  144.     game_stars_randomize()            ;calls a function that randomizes the star positions
  145.  
  146. End Function
  147.  
  148. ;once again, like it's menu equivalent, "game_loop_update()" is a function which analyses player input, working out all the new
  149. ;coordinate positions and anything else which needs deciding before updating the screen display.
  150. Function game_loop_update()
  151.     frames = WaitTimer(timer)
  152.     For i = 1 To frames
  153.         If KeyDown(KEY_PAUSE)                                    ;checks to see if the user has pressed the "PAUSE" key
  154.             FlushKeys
  155.             If game_accept_pause = 1                            ;the "game_accept_pause" variable is used in the same way as "menu_accept_quit" earlier.
  156.                                                                 ;because we're using SCANCODES, the program will register a number of qualifying cases where
  157.                                                                 ;when this check is performed, the key is still held down (at 50 frames per second, if the user
  158.                                                                 ;held down the key for half a second, the KEYDOWN function would fire around 25 times!)
  159.                                                                 
  160.                 If FLAG_PAUSE = 0 Then                            ;If FLAG_PAUSE is 0 then..
  161.                     FLAG_PAUSE = 1                                ;make FLAG_PAUSE = 1
  162.                     game_accept_pause = 0                        ;don't accept any more "PAUSE" button presses until "game_accept_pause" is set back to 1
  163.                     game_pause_frame = 1                        ;make "game_pause_frame" = 1 which, similarly to "menu_frame" earlier will enable the flashing of "PAUSED".
  164.                 Else
  165.                     FLAG_PAUSE = 0                                ;If FLAG_PAUSE isn't 0 (the game was paused) then..
  166.                     game_accept_pause = 0                        ;do exactly the same, but set FLAG_PAUSE to 0.
  167.                     game_pause_frame = 1
  168.                 End If
  169.             End If
  170.         End If
  171.         If KeyDown(KEY_SAVESCREEN)        ;If the "SCREENSAVE" button is pressed..
  172.             FlushKeys                    ;this functions exactly the same as in menu_loop_update()
  173.             FLAG_SAVESCREEN = 1
  174.         End If
  175.         If KeyDown(KEY_QUIT)        ;If the "QUIT" button is pressed..
  176.             FlushKeys
  177.             FLAG_GAMEON=0             ;set FLAG_GAMEON to equal 0. Back in the "game_loop()" function, this will cause the code to jump back to the menu.
  178.         End If
  179.  
  180.         If FLAG_PAUSE = 0 Then                            ;this is really easy! If the game is paused then *don't* do any of the following code. No values will change,
  181.                                                         ;hence nothing will move on the screen when it comes to updating it later! :)
  182.                                                         
  183.                 If KeyDown(KEY_CLOCKWISE)                            ;if "CLOCKWISE" key is pressed then..
  184.                     PLAYER_ANGLE = PLAYER_ANGLE + INCR_ROTATE            ;Add "INCR_ROTATE" degrees to the current PLAYER_ANGLE
  185.                     FlushKeys
  186.                     If PLAYER_ANGLE >= 360 Then                            ;if the PLAYER_ANGLE is 360, then reset it to 0.
  187.                         PLAYER_ANGLE = PLAYER_ANGLE - 360
  188.                     End If
  189.                 End If
  190.                 If KeyDown(KEY_ANTICWISE)                            ;exactly the same, but Subtract "INCR_ROTATE" from the player angle and
  191.                     PLAYER_ANGLE = PLAYER_ANGLE - INCR_ROTATE        ;reset it to (for example) 355, if the angle is -5.
  192.                     FlushKeys
  193.                     If PLAYER_ANGLE < 0 Then
  194.                         PLAYER_ANGLE = PLAYER_ANGLE + 360
  195.                     End If
  196.                 End If
  197.                 If KeyDown(KEY_SPEEDUP) Then                        ;if the "SPEEDUP" key is pressed.
  198.                     If PLAYER_SPEED < SPEED_MAX                            ;as long as the player speed is less than the maximum speed (SPEED_MAX), then
  199.                         PLAYER_SPEED = PLAYER_SPEED + INCR_SPEED        ;Add "INCR_SPEED" to the player's speed value
  200.                         FlushKeys
  201.                     Else
  202.                         PLAYER_SPEED = PLAYER_SPEED - INCR_SLOW            ;if the PLAYER_SPEED is not less than the maximum speed then take "INCR_SLOW" off of it!
  203.                         FlushKeys
  204.                     End If
  205.                 Else                                                ;if the key isn't being pressed, then..
  206.                     If PLAYER_SPEED > 0 Then                            ;as long as the player speed is greater than 0, then take "INCR_SLOW" off the current value
  207.                         PLAYER_SPEED = PLAYER_SPEED - INCR_SLOW            ;(this is an easy "No power" decelaration for the space ship)
  208.                     End If
  209.                     FlushKeys
  210.                 End If
  211.                 If KeyDown(KEY_SPEEDDOWN)                            ;exactly the same thing, but with the ship's thrusters in reverse! :)
  212.                     If PLAYER_SPEED > SPEED_MIN
  213.                         PLAYER_SPEED = PLAYER_SPEED - INCR_SPEED
  214.                         FlushKeys
  215.                     Else
  216.                         PLAYER_SPEED = SPEED_MIN
  217.                         FlushKeys
  218.                     End If
  219.                 Else
  220.                     If PLAYER_SPEED < 0 Then
  221.                         PLAYER_SPEED = PLAYER_SPEED + INCR_SLOW
  222.                     End If
  223.                 End If
  224.                 
  225.                 ;this next peice of code updates the player position on the map, relative to it's Speed and Angle and it's last position
  226.                 PLAYER_X = PLAYER_X + (PLAYER_SPEED*(Sin(PLAYER_ANGLE)/2))
  227.                 PLAYER_Y = PLAYER_Y - (PLAYER_SPEED*(Cos(PLAYER_ANGLE)/2))
  228.                 If PLAYER_X < 0 Then                        ;if the PLAYER_X value is less than 0, then wrap your position around the map
  229.                     PLAYER_X = (PLAYER_X + GAME_AREA_X)        ;by adding the GAME_AREA_X value to the negative value, i.e.: -5 becomes 19995 on a 20000 X pixel map.
  230.                 End If
  231.                 If PLAYER_X > GAME_AREA_X Then                ;the same in reverse, i.e. 20004 becomes 4 on the same map.
  232.                     PLAYER_X = (PLAYER_X - GAME_AREA_X)
  233.                 End If
  234.                 If PLAYER_Y < 0 Then                        ;and now the same for the Y direction
  235.                     PLAYER_Y = (PLAYER_Y + GAME_AREA_Y)
  236.                 End If
  237.                 If PLAYER_Y > GAME_AREA_Y Then
  238.                     PLAYER_Y = (PLAYER_Y - GAME_AREA_Y)
  239.                 End If
  240.             
  241.  
  242.             ;the parralex stars move relative to the player and is just the same "menustars" number of stars
  243.             ;scrolled at various speeds, wrapping around the screen.
  244.             ;it's a fairly cheap, but effective way of creating a nice illusion of speed!
  245.             If starson=1 Then                ;if, at the beginning of the program, you set "starson" to 0, the stars will disappear.
  246.                                             ;the game would also feel pretty bloody wierd.. hold on.. yep.. Absolutely mad! Try it! :)
  247.                 For star.stars=Each stars
  248.                     ;the following two lines move each version of the "stars" Type an x and y distance relative to the player's speed and angle
  249.                     ;with a devision relative to the depth of the star to make the smallest stars move slower than the biggest
  250.                     ;thus we have our parallex effect.
  251.                     
  252.                     ;it might be of interest to know that these two lines were based on the OLDSKOOL demo which comes with Blitz Basic
  253.                     ;and was the starting point for the whole CELESTIAL RIFT game concept! Thanks a lot, Mr Mikkel L°kke!! :)
  254.                     star\y=(star\y+PLAYER_SPEED*(Cos(360-PLAYER_ANGLE)/(6-star\depth+1)))
  255.                     star\x=(star\x+PLAYER_SPEED*(Sin(360-PLAYER_ANGLE)/(6-star\depth+1)))
  256.                     ;the maximum pixel width of for the biggest star image is 5 pixels
  257.                     ;the following IF statements wrap the stars around the screen border when they reach the extremities
  258.                     If star\x < -5 Then
  259.                         star\x = star\x + (SCREEN_WIDTH + 5)
  260.                     End If
  261.                     If star\x > SCREEN_WIDTH Then
  262.                         star\x = star\x - (SCREEN_WIDTH + 5)
  263.                     End If
  264.                     If star\y <= -5 Then
  265.                         star\y = star\y + (SCREEN_HEIGHT + 5)
  266.                     End If
  267.                     If star\y >= SCREEN_HEIGHT
  268.                         star\y = star\y - (SCREEN_HEIGHT + 5)
  269.                     End If
  270.                 Next
  271.             End If    ;end of the "are the stars going to be shown" IF statement
  272.  
  273.             PLAYER_SCORE = PLAYER_SCORE + 1        ;if the game is in progress, then increase the PLAYER_SCORE by 1 every screen update
  274.                                                     ;this acts as a kind of survival bonus for the more defensive player
  275.                 If PLAYER_SCORE >= HI_SCORE Then
  276.                     HI_SCORE = PLAYER_SCORE
  277.                 End If
  278.             
  279.         End If ;end of "IF FLAG_PAUSE = 0" IF Statement
  280.         
  281.         ;this flashes the "PAUSED" caption on and off when needs be!
  282.         game_pause_frame = game_pause_frame + 1
  283.         If game_pause_frame = 25 Then
  284.             game_pause_frame = 1
  285.             game_accept_pause = 1
  286.             If game_pause_stat = 1 Then
  287.                 game_pause_stat = 0
  288.             Else
  289.                 game_pause_stat = 1
  290.             End If
  291.         End If
  292.  
  293.     Next    ;end of the "for i = 1 to frames" FOR loop
  294.     
  295.     game_draw_update()    ;finally, draw all the pictures on the screen, based on their (possibly) new positions.
  296. End Function
  297.  
  298. ;this function draws the game graphics in their freshly calculated positions
  299. Function game_draw_update()
  300.     SetBuffer BackBuffer()    ;draw all of the following to the backbuffer
  301.     ClsColor 0,0,0            ;changes the CLearScreen colour to black (0,0,0)
  302.     Cls
  303.     If starson=1 Then        ;draw all of the stars using their correct pictures, at the correct x and y positions
  304.         For star.stars=Each stars ;(for each star in type 'stars' do the following..)
  305.             DrawImage game_stars(star\depth),star\x,star\y    ;using the depth property of "stars" as the Array position
  306.         Next
  307.     End If
  308.     
  309.     game_player_frame = PLAYER_ANGLE/5
  310.     If game_player_frame = 72 Then
  311.         game_player_frame = 0
  312.     End If
  313.     
  314.     DrawImage game_player,(SCREEN_WIDTH/2)-ImageWidth(game_player)/2,(SCREEN_HEIGHT/2)-ImageHeight(game_player)/2,game_player_frame
  315.     
  316.     ;As we said before, the foremost pictures/displayed objects are drawn last in our Video collage.
  317.     Color 0,128,0
  318.     Text SCREEN_WIDTH-210,220,"SCORE: " + PLAYER_SCORE
  319.     Text SCREEN_WIDTH-210,240,"HISCR: " + HI_SCORE
  320.     Line SCREEN_WIDTH-210,3,SCREEN_WIDTH-10,3
  321.     Line SCREEN_WIDTH-210,213,SCREEN_WIDTH-10,213
  322.     Line SCREEN_WIDTH-210,3,SCREEN_WIDTH-210,213
  323.     Line SCREEN_WIDTH-10,3,SCREEN_WIDTH-10,213
  324.         ;notice that by using a calculated x coordinate "SCREEN_WIDTH - value" in conjunction with a fixed
  325.         ;y coordinate, we will have the HUD images at the same distance from the top right of the screen
  326.         ;in any Graphics resolution we choose -- PLUS I've made the radar border GREEN using the color command
  327.         
  328.     Color 255,0,255
  329.     
  330.     ;this next bit of code draws the coloured dots on the radar
  331.     DrawImage game_player_dot,((SCREEN_WIDTH-211)+PLAYER_X/(GAME_AREA_X/200)),((9)+PLAYER_Y/(GAME_AREA_Y/200))
  332.  
  333.     ;if the game is paused (FLAG_PAUSE = 1) then draw the image when "game_pause_stat" = 1
  334.     ;this gives us our flash on-off effect as used earlier in "menu_draw_update()"
  335.     
  336.     If FLAG_PAUSE = 1 And game_pause_stat = 1 Then
  337.         DrawImage game_paused,SCREEN_WIDTH/2-ImageWidth(game_paused)/2,SCREEN_HEIGHT-((SCREEN_HEIGHT-350)/2+ImageHeight(game_paused)/2)
  338.     End If
  339.     
  340.     ;the following text will only be printed on the screen while the "FLAG_DEBUG" variable is set to 1 (which for the purpose of this tutorial, we've left it at!)
  341.     If FLAG_DEBUG = 1 Then
  342.         ;the TEXT command writes a STRING of text onto the screen at the given coordinates in the currently set font
  343.         ;as I haven't used the LoadFont or SetFont commands, this will just be Blitz' default font.
  344.  
  345.         Color 255,255,255                                    ;just in case, set the colo(u)r of the text to WHITE (255, 255, 255)
  346.         Text 0,0,"PLAYER ANGLE = " + PLAYER_ANGLE                ;"Write the string 'PLAYER ANGLE = ' followed by the number held in PLAYER_ANGLE"
  347.         Text 0,20,"PLAYER SPEED = " + PLAYER_SPEED
  348.         Text 0,40,PLAYER_ANGLE + " / 5 = " + PLAYER_ANGLE/5
  349.         Text 0,60,"SHIPFRAME = " + game_player_frame
  350.         Text 0,80,"CO-ORDS = " + Int(PLAYER_X)
  351.         Text 140,80," , " 
  352.         Text 160,80,Int(PLAYER_Y)
  353.         Text 0,120, "SCORE = " + PLAYER_SCORE
  354.     End If
  355.     
  356.     ;just like in "menu_draw_update()", the user can press a key which just makes the value of "FLAG_SCREENSAVE" equal 1.
  357.     ;when the code gets to here, it saves out the named Buffer as a BMP picture.
  358.     If FLAG_SAVESCREEN=1 Then
  359.         SaveBuffer (BackBuffer(),"CRGameScreen.bmp")
  360.         FLAG_SAVESCREEN = 0
  361.     End If 
  362.     
  363.     Flip                    ;as before in "menu_draw_update()", FLIP everything we've just drawn on the backbuffer and show it on the frontbuffer, i.e.: your monitor!!
  364. End Function
  365.  
  366. ;a little function which randomizes the x and y coordinates of each version of the "stars" Type, plus it's "depth" property
  367. Function game_stars_randomize()
  368.     For star.stars=Each stars
  369.         star\x=Rnd(-5,SCREEN_WIDTH)            ;create random x and y positions for all the stars
  370.         star\y=Rnd(-5,SCREEN_HEIGHT)
  371.         star\depth=Rnd(1,5)                    ;the depth of the stars results in our sexy parallex effect
  372.     Next
  373. End Function
  374.  
  375. ;an even littler function which just gives us random x and y coordinates for the player.
  376. Function game_player_randomize()
  377.     PLAYER_X = Rand(0,GAME_AREA_X)
  378.     PLAYER_Y = Rand(0,GAME_AREA_Y)
  379. End Function