home *** CD-ROM | disk | FTP | other *** search
/ AMOS PD CD / amospdcd.iso / authors / chris_evans / twilightscroll.amos / twilightscroll.amosSourceCode < prev   
AMOS Source Code  |  1986-08-03  |  4KB  |  150 lines

  1. '--------------------------
  2. ' TWILIGHT SCROLL  
  3. '      by  
  4. ' Chris Evans
  5. ' 44 Shady Lane - RR7
  6. ' St. Thomas, ON 
  7. ' Canada  N5P 3T2
  8. '-------------------------- (letters welcome)
  9. '
  10. ' Want to create the same type of parallax scrolling scene   
  11. ' as in Shadow of the Beast I?  Dual playfield can do this,
  12. ' but it will generally need some tweaking.  Dual playfield
  13. ' also restricts you to 8 colors, which throws a wrench at 
  14. ' multi-colored 3D objects.  Usually a slower scroll is
  15. ' safer.  To save processor time, you should only scroll 
  16. ' or copy the areas of the screen with the backround or  
  17. ' whatever you are scrolling.
  18. '  
  19. ' ABOUT THIS EXAMPLE SCROLL  
  20. '
  21. ' This parallax scroll is a twilight scene, with a distant 
  22. ' black mountain range and a closer dark green foreground.   
  23. ' The difference in scroll speed between the two gives the 
  24. ' impression of depth or distance.  The scenery was created
  25. ' with Deluxe Paint 4.1, placed in an icon bank, and   
  26. ' controlled with Paste Icon.  (This gives a smoother scroll 
  27. ' than the Get Block code).  Since the bank isn't printable  
  28. ' Amos code, to run this example you will need to get the  
  29. ' disk it's on with the icon bank and tracker bank.  If you
  30. ' don't want to have the side screen borders use a screen
  31. ' width of 352 or more pixels.   
  32. '
  33. ' If you choose to use this code with a bob, use Set Bob 
  34. ' [number],-1,,  where number is the bob number.  This 
  35. ' tells Amos to not bother keeping the scroll under it 
  36. ' because the scroll is constantly being redrawn anyway. 
  37. ' Also, use Update Off, and put Bob Draw just before the 
  38. ' Screen Swap and Wait Vbl instructions.  That way, the
  39. ' bob won't be automatically displayed as soon as it's 
  40. ' moved and mess up the display.  Using Break Off (below)
  41. ' increases program speed.  The foreground scrolls 
  42. ' smoothly on unaccelerated Amigas, but has an inter-
  43. ' mittant jerk on the A3000 030.  If anyone has a fix
  44. ' please forward it.   
  45. '
  46. ' There are specific comments within the code. 
  47. '
  48. Break Off 
  49. ' Using Copper Off removes the startup flicker.
  50. Copper Off 
  51. ' To end this program, push a mouse button.
  52. '
  53. ' Make a mask for the foreground so it overlaps the background.  
  54. Make Icon Mask 2
  55. '
  56. ' Open screen 0 for the scroll.    
  57. Screen Open 0,320,200,4,Lowres
  58. '
  59. ' Double buffer it for smoother animation.   
  60. Double Buffer 
  61. Autoback 0
  62. '
  63. ' Clear the cursor off the screen, stop the flashing,  
  64. ' and set the colours. 
  65. Curs Off 
  66. Flash Off 
  67. Cls 0
  68. Palette $7,$0,,$80
  69. '
  70. 'Open screen 1 for the moon and stars. 
  71. Screen Open 1,320,100,8,Lowres
  72. Curs Off 
  73. Flash Off 
  74. Cls 0
  75. '
  76. Palette $7,,,,$FF0,$FFF,$AAA,$555
  77. '
  78. 'Paste on the moon.
  79. Paste Icon 44,43,3
  80. '
  81. 'Put on three stars. 
  82. MAKE_STAR[162,25]
  83. MAKE_STAR[211,97]
  84. MAKE_STAR[275,46]
  85. '
  86. 'Make sure the scroll goes to screen 0...  
  87. Screen 0
  88. '
  89. '...start the music... 
  90. '
  91. Track Play 3
  92. '
  93. '...reactivate the copper... 
  94. '
  95. Copper On 
  96. '
  97. '...and hide the mouse.
  98. '
  99. Hide On 
  100. '
  101. 'The main loop...
  102. '
  103. Repeat 
  104.    '    
  105.    XT=0
  106.    For X=0 To -319 Step -1
  107.       Add XT,-2
  108.       Cls 0
  109.       '      
  110.       'Put on the background and its double... 
  111.       Paste Icon X,142,1
  112.       Paste Icon X+319,142,1
  113.       '      
  114.       'Add the foreground... 
  115.       If XT>-320
  116.          Paste Icon XT,187,2
  117.          Paste Icon XT+319,187,2
  118.       Else 
  119.          Paste Icon XT+319,187,2
  120.          Paste Icon XT+638,187,2
  121.       End If 
  122.       '      
  123.       'Display the new image.
  124.       Screen Swap 
  125.       Wait Vbl 
  126.       '      
  127.       'If a mouse button has been pressed, leave these loops.
  128.       Exit If Mouse Key>0,2
  129.       '      
  130.    Next X
  131.    '    
  132. Until Mouse Key>0
  133. '
  134. Procedure MAKE_STAR[X,Y]
  135.    '
  136.    'Inputs:  X -- the X co-ordinate of the star to be drawn 
  137.    '         Y -- the Y co-ordinate of the star to be drawn 
  138.    '
  139.    'Output:  Draws a star at (X, Y) 
  140.    '  
  141.    Plot X,Y,5
  142.    Plot X-1,Y,6
  143.    Plot X+1,Y,6
  144.    Plot X,Y-1,6
  145.    Plot X,Y+1,6
  146.    Plot X-2,Y,7
  147.    Plot X+2,Y,7
  148.    Plot X,Y-2,7
  149.    Plot X,Y+2,7
  150. End Proc