home *** CD-ROM | disk | FTP | other *** search
/ No Fragments Archive 10: Diskmags / nf_archive_10.iso / MAGS / ST_USER / 1990 / USEROC90.MSA / TEXT_STOS.DOC < prev    next >
Text File  |  1990-08-19  |  8KB  |  160 lines

  1.                              HAVING A BALL
  2.  
  3.  
  4.          Phil lawson takes a break from programming to give you the
  5.            bare bones of a game. It's up to you to finish it off
  6.  
  7.  
  8.     One of the hardest parts of writing a game is getting the ideas in the
  9. first place and if you can't get past this point you might as well give up
  10. before you start. STOS is best suited to arcade and strategy games, but it's no
  11. use trying to write an 'if it moves, zap it' game if you haven't planned all
  12. the different screens, levels and features. Strategy games can be cobbled
  13. together as you go, as most extra features can be written as self-contained
  14. subroutines, but some overall plan is needed at least.
  15.  
  16.     Over the past couple of months we've discovered how to bounce sprites
  17. around the screen, and in particular, off various obstacles. You may have been
  18. wondering where all these tricks and methods were leading, in which case your
  19. question is answered this month.
  20.  
  21.     What I've done is to write the main controlling loop of a strategy game,
  22. but it's up to you to finish it off. This should put your programming skills to
  23. the test, so you can monitor your own progress.
  24.  
  25.     Anyone familiar with the old 8-bit game Gate Crasher will recognise
  26. STOS.BAS in the LISTINGS folder. The object is to drop a ball from the top of
  27. the screen, which then travels along the platforms, drops through holes and
  28. finally ends up in one of the eight slots at the bottom. Dotted around the
  29. screen are deflectors which will change the ball's direction.
  30.  
  31.     To position the ball use the left and right arrow keys and drop it with the
  32. spacebar. The game will automatically end when each slot contains a ball.
  33.  
  34.     The original version of the game had many features, some of which are:
  35.  
  36. SHUFFLE
  37. SCROLLING
  38. LIMITED BALLS (20)
  39. BLANKED OUT PLATFORMS (only the deflectors showing)
  40. BLANKED-OUT DEFLECTORS ON HIGHER LEVELS (only the platforms showing)
  41. HAVING TO PUT THE BALLS INTO THE SLOTS IN A DEFINED ORDER
  42.  
  43.     What you should try and do is add some or all of these to the original game
  44. - I have provided the bare bones of the game, but it is up to you to add the
  45. frills. You could also devise a few of your own, and maybe the best one sent in
  46. will appear on a future cover disk.
  47.  
  48.     The whole program hinges on the bouncing techniques covered in the past
  49. couple of issues, so if you haven't got them order some back copies now! Just
  50. to recap, the hot-spot of the ball is placed smack bang in the centre, which
  51. means the dimensions of the ball have to be an odd number of pixels, otherwise
  52. there would be no centre position.
  53.  
  54.     Using the POINT command, we can test the colour of the background screen
  55. immediately under the hot spot, which tells us of the ball has hit anything. If
  56. it has, we now define four points around the hot spot, (as shown in Table II),
  57. and use these to check what type of object has been hit. Since we know the
  58. direction in which the ball was originally moving, and we now know what type of
  59. object it has met, we can easily work out its new direction.
  60.  
  61.            p2- *   * -p3
  62.  
  63.                  * - hot spot
  64.  
  65.            p1- *   * -p4
  66.  
  67.     If the coordinates of the hot spot are X and Y, the coordinates for each of
  68. the four points are:
  69.  
  70. p1 = X-1,Y+1
  71. p2 = X-1,Y-1
  72. p3 = X+1,Y-1
  73. p4 = X+1,Y+1
  74.  
  75.     Now for a brief rundown of the main control loop. The initialisation
  76. routine at line 500, sets up a few variables and two animation strings to give
  77. the ball the appearance that it is actually rolling. The array slot(8) stores
  78. the status of each slot at the bottom of the screen. If, for instance, slot(3)
  79. equals 1, a ball is already present in the third slot, but a value of zero
  80. would mean it was empty.
  81.  
  82.     Before dropping a ball, the player first has the choice of where to
  83. position it along the top of the screen. This is handled by the routine
  84. starting at line 8000.
  85.  
  86.     When the ball drops one of two things will happen. It will either fall onto
  87. a deflector or a platform. These possibilities are checked for in the Drop Ball
  88. routine at 7000, which also calculates the new direction. If the ball lands on
  89. a platform it will retain its original direction until either it reaches
  90. another hole to fall through or it hits a side wall, in which case its
  91. direction is simply reversed. This is controlled by the Hit Wall routine at
  92. line 1800.
  93.  
  94.     The routine at 1100 is used whenever a ball is about to drop into a slot.
  95. It checks whether a ball is already in that slot and if there is, that slot now
  96. becomes empty which means you'll have to fill it again. The final part of this
  97. routine tests for a ball in each slot and sets the variable 'done'
  98. accordingly.
  99.  
  100.  
  101.  
  102.                      FEATURES TO BE ADDED
  103.                     **********************
  104.  
  105. BALLS - The original game only allowed 20 balls to be used, which meant you had
  106. to think very carefully before dropping one.
  107.  
  108. SHUFFLE - Causes between 50% and 75% of the deflectors to be changed. For
  109. example, if a deflector was / it would possibly be altered to \. This feature
  110. reduces the number of balls left by one.
  111.  
  112. BLANKED-OUT PLATFORMS - Only the deflectors and bottom slots are shown. The
  113. positions of the platforms and the holes in them have to be worked out by
  114. watching where the ball goes. Should be used only for higher levels.
  115.  
  116. BLANKED-OUT DEFLECTORS - Everything is shown apart from the deflectors, so the
  117. angles, (/ or \) will have to be worked out by watching which way the ball
  118. moves. Should be used on levels higher than those with blanked-out platforms.
  119.  
  120. DEFINED ORDER - The balls must be placed into the slots in a predefined order.
  121. To indicate the order, display the values 1 to 8 in each slot, where 1 must be
  122. the first filled slot and 8 must be the last. Should be used on medium levels.
  123.  
  124. SCROLLING - This is by far the most impressive featue of the original game, but
  125. is also the most difficult to implement. By using the up and down arrow keys
  126. the playing area would scroll, allowing you to position the deflectors and
  127. platforms so the ball could get to the more difficult slots. Unless you've seen
  128. the original game, this scrolling can be rather difficult to explain, but I'll
  129. try my best. Take a look at Picture 1:
  130.  
  131. PICTURE1.PC1:<<SCREENSHOT>>
  132.  
  133.     This shows the original screen, (1) along with the resulting screen layout
  134. after each upward scroll. Notice the + marks, which show the lines where
  135. deflectors may have to be altered when scrolling upwards. This is done by
  136. checking the area directly above and below each deflector positon. If the above
  137. one is empty and the below one is part of a platorm, a deflector is required in
  138. that position so put one there if one isn't already present.
  139.  
  140.     If a deflector is not required, blank out that part of the screen either by
  141. using the BAR command to draw an empty block, or use a small sprite and PUT it
  142. on the screen. Note that both of these will require another colour other than
  143. zero to be defined as black, otherwise your block/sprite will be treated as
  144. transparent.
  145.  
  146.     The rules for scrolling down are exactly the same, except it's the top two
  147. lines and the bottom one which will need the deflectors altering. To actually
  148. scroll the screen, don't forget to copy the top/bottom part before you
  149. overwrite it. This can easily be done with the SCREEN$ command, which can be
  150. placed back again afterwards.
  151.  
  152.     I have now given enough information for you to start working on your
  153. masterpiece, but you don't have to stick to the features outlined here. Try to
  154. devise some of your own, and the more devious the better for the higher levels.
  155. Also feel free to alter any of the graphics, and try including some of the many
  156. techniques we've discovered in the past.
  157.  
  158.     That just about wraps it up for this month, and since my ST is back in
  159. working order I'll get the Sprite Path Definer program finished for next time.
  160.