home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AMOS PD CD
/
amospdcd.iso
/
authors
/
chris_evans
/
twilightscroll.amos
/
twilightscroll.amosSourceCode
< prev
Wrap
AMOS Source Code
|
1986-08-03
|
4KB
|
150 lines
'--------------------------
' TWILIGHT SCROLL
' by
' Chris Evans
' 44 Shady Lane - RR7
' St. Thomas, ON
' Canada N5P 3T2
'-------------------------- (letters welcome)
'
' Want to create the same type of parallax scrolling scene
' as in Shadow of the Beast I? Dual playfield can do this,
' but it will generally need some tweaking. Dual playfield
' also restricts you to 8 colors, which throws a wrench at
' multi-colored 3D objects. Usually a slower scroll is
' safer. To save processor time, you should only scroll
' or copy the areas of the screen with the backround or
' whatever you are scrolling.
'
' ABOUT THIS EXAMPLE SCROLL
'
' This parallax scroll is a twilight scene, with a distant
' black mountain range and a closer dark green foreground.
' The difference in scroll speed between the two gives the
' impression of depth or distance. The scenery was created
' with Deluxe Paint 4.1, placed in an icon bank, and
' controlled with Paste Icon. (This gives a smoother scroll
' than the Get Block code). Since the bank isn't printable
' Amos code, to run this example you will need to get the
' disk it's on with the icon bank and tracker bank. If you
' don't want to have the side screen borders use a screen
' width of 352 or more pixels.
'
' If you choose to use this code with a bob, use Set Bob
' [number],-1,, where number is the bob number. This
' tells Amos to not bother keeping the scroll under it
' because the scroll is constantly being redrawn anyway.
' Also, use Update Off, and put Bob Draw just before the
' Screen Swap and Wait Vbl instructions. That way, the
' bob won't be automatically displayed as soon as it's
' moved and mess up the display. Using Break Off (below)
' increases program speed. The foreground scrolls
' smoothly on unaccelerated Amigas, but has an inter-
' mittant jerk on the A3000 030. If anyone has a fix
' please forward it.
'
' There are specific comments within the code.
'
Break Off
' Using Copper Off removes the startup flicker.
Copper Off
' To end this program, push a mouse button.
'
' Make a mask for the foreground so it overlaps the background.
Make Icon Mask 2
'
' Open screen 0 for the scroll.
Screen Open 0,320,200,4,Lowres
'
' Double buffer it for smoother animation.
Double Buffer
Autoback 0
'
' Clear the cursor off the screen, stop the flashing,
' and set the colours.
Curs Off
Flash Off
Cls 0
Palette $7,$0,,$80
'
'Open screen 1 for the moon and stars.
Screen Open 1,320,100,8,Lowres
Curs Off
Flash Off
Cls 0
'
Palette $7,,,,$FF0,$FFF,$AAA,$555
'
'Paste on the moon.
Paste Icon 44,43,3
'
'Put on three stars.
MAKE_STAR[162,25]
MAKE_STAR[211,97]
MAKE_STAR[275,46]
'
'Make sure the scroll goes to screen 0...
Screen 0
'
'...start the music...
'
Track Play 3
'
'...reactivate the copper...
'
Copper On
'
'...and hide the mouse.
'
Hide On
'
'The main loop...
'
Repeat
'
XT=0
For X=0 To -319 Step -1
Add XT,-2
Cls 0
'
'Put on the background and its double...
Paste Icon X,142,1
Paste Icon X+319,142,1
'
'Add the foreground...
If XT>-320
Paste Icon XT,187,2
Paste Icon XT+319,187,2
Else
Paste Icon XT+319,187,2
Paste Icon XT+638,187,2
End If
'
'Display the new image.
Screen Swap
Wait Vbl
'
'If a mouse button has been pressed, leave these loops.
Exit If Mouse Key>0,2
'
Next X
'
Until Mouse Key>0
'
Procedure MAKE_STAR[X,Y]
'
'Inputs: X -- the X co-ordinate of the star to be drawn
' Y -- the Y co-ordinate of the star to be drawn
'
'Output: Draws a star at (X, Y)
'
Plot X,Y,5
Plot X-1,Y,6
Plot X+1,Y,6
Plot X,Y-1,6
Plot X,Y+1,6
Plot X-2,Y,7
Plot X+2,Y,7
Plot X,Y-2,7
Plot X,Y+2,7
End Proc