home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AMOS PD CD
/
amospdcd.iso
/
sourcecode
/
procedures
/
letter_slide.amos
/
letter_slide.amosSourceCode
< prev
next >
Wrap
AMOS Source Code
|
1993-03-07
|
5KB
|
141 lines
'**************************************************************
'
' LETTER SLIDE
'
' Copyright (c) 1993
'
' Peter Paton & Vic Webber
'
' Having almost completed our first ever game we were playing
' with ideas for the intro screens and, as the game is a sliding
' tile type puzzle game, thought it might be nice to have some
' sliding letters on the title screen.
'
' Everybody does this type of thing by just sliding letters at random
' onto the screen to form words, but we wanted to be different so we
' came up with the idea that we could make up an anagram of the game
' title and get the letters from the title to slide into the anagram.
'
' This was the first attempt and took just a couple of hours.
'
' The letters move at a nice sedate pace, but if you take out the
' Wait Vbl instructions it will leave you breathless.
'
' I have Rem(ed) most of the code and you are welcome to use
' routine and adapt it for your own programs.
'
' Big thanks to my wife Cath for the anagram of Amiga Stepping Stones
' She is 20 years younger than me and thinks along totally different
' lines to me. My own anagram was so boring that I won't even tell you it.
' If you want to tell her that you can't have two G's in MEGGA then
' she may well tell you where to stick the spare G
'
' The bob files have been included on the disk in Tiles.Abk
'
'
Screen Open 0,320,256,32,Lowres
Flash Off : Curs Off : Hide On
Cls 16
Palette 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
'
Global C$,_MOVE$
'
_STRING["AMOS",132,80]
_STRING[" AMIGA STEPPING STONES ",55,100]
'
' The spaces at the ends of Amiga Stepping Stones are simply padding
' to make the two trings the same length and thus make them print
' at the same csreen address. This helps to make the maths easier.
' Note that the anagram string has two extra spaces in the words.
'
_MOVE$=C$
_STRING["STEPS INTO A MEGGA SPIN",55,132]
'
' Now get the original bob palette back and the letters appear
' in one go
Fade 1 To -1
'
' Wait to allow you time to read what's on the screen
Wait 200
'
'
_MOVE_CHAR
'
' This first procedure is an adaptation of the idea used in text scrolling
' where leters are taken from another screen and placed into a scroll.
'
' We simply made an 8x8 font in Dpaint and then cut it into bobs
' these start at bob No. 20 in the Tiles.Abk
'
'
Procedure _STRING[C$,CPOSX,CPOSY]
' T$ holds a string giving the position of the 8x8 bobs in the file
T$="ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789+"
' C$ is the string to be printed
For I=1 To Len(C$)
' C2$ holds the letters within C$
C2$=Mid$(C$,I,1)
' C is set to the position of C2$ within T$
' This has 19 added to it because the bobs start at 20 in the bank
C=Instr(T$,C2$)
Paste Bob CPOSX,CPOSY,C+19
' CPOSX and CPOSY hold the graphic co-ordinates of the top left corner
' of the first letter of C$ and is incremented by 8 for each character
' printed. (8x8 font so add 8 pixels)
CPOSX=CPOSX+8
Next
End Proc
Procedure _MOVE_CHAR
' This is the real work horse of the routine
'
' Notice from the program above that _MOVE$ is picked up from
' the game title string.
'
' Now pick each letter in turn
For L=1 To Len(_MOVE$)
X1=55+((L-1)*8) : Rem Top left corner of letter
X2=X1+8 : Rem 8 is the letters width
Y1=99 : Rem Top line of letter-1 to avoid leaving trails
Y2=131 : Rem Bottom of first scroll definition
QQ$=Mid$(_MOVE$,L,1) : Rem Grab the letter from the title
QQ=Instr(C$,QQ$) : Rem find the first matching letter in the anagram
Mid$(C$,QQ,1)=" " : Rem and turn it into a space
X3=55+((QQ-1)*8) : Rem Then find its graphic position
X4=X3+8 : Rem Set right hand side of 3rd scroll zone
' Now we nee to set the direction for the horizontal scroll
If X3<X1 Then D=-1 : X5=X1-X3 Else D=1 : X5=X3-X1
' Set the ink colour for the letter to the loop counter
Ink L
' Theres no point in scrolling a blank space so skip it
If QQ$=" " Then Goto SKIP
' The paint co-ordinates had to find a spot which was set in all letters
' and we could have done this scientifically but we just took a guess
' at 3 pixels in and 2 pixels down and got lucky, (jammy buggers).
Paint X1+3,Y1+2 : Wait 50
' Now set up the 3 scroll definitions
Def Scroll 1,X1,Y1 To X2,Y2,0,1
Def Scroll 2,55,120 To 247,131,D,0
Def Scroll 3,X3,119 To X4,152,0,1
'
' This loop does the first downward slide
For I=1 To 20
Scroll 1
Wait Vbl
Next
' These two are for the left or right scroll
' If D=1 then scroll left to right
' If D=-1 then scroll right to left
' The co-ordinates need to be turned round if D=-1 to define
' rectangle to be scrolled properly where right side is > left side
If D=1 Then For I=1 To X5 : Scroll 2 : Wait Vbl : Next
If D=-1 Then For I=X5 To 1 Step D : Scroll 2 : Wait Vbl : Next
' And last but not least drop the letters into place
For I=1 To 12
Scroll 3
Wait Vbl
Next
' Land here to avoid moving blank spaces
SKIP:
Next
End Proc