SCREEN EFFECTS This article is from Atari ST User iss.2 -90. It is written to this mag by Sorcerer of The Digital Dictators! Wešll start by examinig the various methods of displaying a title screen. Alternatively draw your own title screen with an art package, compact it and store it in memory bank five.Bank six should also contain a compacted screen of text,and you can easily design your own,with a routine similar to Program I.Here it is: 10 REM Program I 20 REM Create text screen 30 MODE 0:KEY OFF:HIDE 40 WINDOPEN 1,0,0,40,12,0,3:CURS OFF:PEN 14 50 FOR a=0 TO 11:LOCATE 0,a 60 READ mess$:CENTRE mess$ 70 NEXT a:WAIT 100 80 SAVE "MESSAGE.PI1",BACK 90 GOTO 90 1000 DATA "Build your title screens from sprites","used within the game." 1010 DATA "Try different ways of displaying the","title screen for impressive effects." 1020 DATA "Use scrolling text and flashing colours","for displaying instructions." 1030 DATA "Donšt forget to buy Atari ST User for","STOS programming hints and tips." 1040 DATA "Or even better,get yourself each TPS","magazine for BOTH STOS tips and GFA or ASM tips!" 1050 DATA "And please get our compact menus too!","They are really great!!!" The saved text picture should be compressed using COMPACT.ACB,but first you should add some interesting features to the letters with an art package such as Degas Elite.When designing a title screen itšs best first to write a routine which displays all the gamešs sprites and saves the whole screen as a picture file.This can then be edited and changed using an art package to give a professional,high quality appearance. The different ways of displaying title screens wešll be covering are just a few of the many effects possible.Išll leave it up to you to discover others and include your own animation sequences, although itšs worth bearing in mind that subtle effects can be achieved by simple palette switching with the SHIFT command. Enough of the chat,letšs get down to business.The next two programs show simple ways of adding spice to the commands APPEAR and FADE: 20000 REM Title screen #1 20010 MODE 0:KEY OFF 20020 CURS OFF:HIDE 20030 RESERVE AS SCREEN 10:RESERVE AS SCREEN 11 20040 UNPACK 5,10:UNPACK 6,11 20050 SCREEN COPY 11 TO PHYSIC:WAIT 50 20060 FADE 5,$777,$777,$777,$777,$777,$777,$777,$777,$777,$777,$777, $777,$777,$777,$777,$777:WAIT 35 20070 CLW:s$=SCREEN$(10,0,0 TO 320,200):SCREEN$(PHYSIC,0,0)=s$ 20080 WAIT 50 20090 FADE 5 TO 10:WAIT 35 20100 GOTO 20100 20000 REM Title screen #2 20010 MODE 0:KEY OFF 20020 CURS OFF:HIDE 20030 RESERVE AS SCREEN 10:RESERVE AS SCREEN 11 20040 UNPACK 5,10:UNPACK 6,11 20050 SCREEN COPY 11 TO PHYSIC 20060 APPEAR 10,77 20070 APPEAR 10,20 20080 GOTO 20080 The first program displays the message screen,fades all the colours to white,clears the screen,draws the title and fades from white to the correct colours.Most STOS programmers seem to fade the colours to black or white only,but therešs no reason why others such as blue,green,yellow and red cannot be used. The second program snippet implements a little used feature of the APPEAR command,the syntax of which is: APPEAR screen,fade type If the fade type is greater than 72,the final picture is left as a mixture of the original screen displayand the one youšre attempting to fade in.This allows us to use two different types of fade,one immediately after the other,giving a very pleasing effect.Try altering the fade values in lines 20060 and 20070 and note those which give an interesting result. Notice that in the above two programs lines 20010 to 20040 are identical.This is true for every program wešll be using in this article,so to save space Išll omit them from the listings,but donšt forget to type them in yourself. SCROLLED SCREENS One of the most versatile commands in STOS is SCREEN COPY,which, as its name suggests,copies a defined area of one screen to a given place on another.The syntax of this command is: SCREEN COPY s1,x1,y1,x2,y2 TO s2,x3,y3 s1 = Source screen s2 = Destination screen x1,y1 = Top left corner of area x2,y2 = Bottom right corner of area x3,y3 = Top left corner to place area This opens up the possibility of displaying a title picture one section at a time and scrolling the image over the current display. Run the following program: 20000 REM Title screen #3 20050 FOR a=1 TO 200 20060 SCREEN COPY 10,0,0,320,a TO PHYSIC,0,200-a 20070 NEXT a 20080 GOTO 20080 The scrolling effect may look rather complex,but itšs all controlled with lines 20050 to 20070.Each time round the FOR/NEXT loop,an increasingly larger section of the picture stored in bank 10 is copied to the physical screen.This gives the appearance that the image is being scrolled up from the bottom of the screen.To see it slowly covering an existing picture,add this line: 20045 SCREEN COPY 11 TO PHYSIC:WAIT 100 Instead of overwriting the original picture we could scroll it off the top of the screen by adding line 20055 and changing line 20060: 20000 REM Title screen #3b 20055 SCREEN COPY PHYSIC,0,1,320,199 TO PHYSIC,0,0 20060 SCREEN COPY 10,0,a-1,320,a TO PHYSIC,0,198 Itšs also possible to scroll the picture down the screen rather than upwards: 20000 REM Title screen #4 20050 SCREEN COPY 11 TO PHYSIC 20060 WAIT 100:FOR a=1 TO 200 20070 SCREEN COPY 10,0,200-a,320,200 TO PHYSIC,0,0 20080 NEXT a 20090 GOTO 20090 So far wešve scrolled the whole screen either up or down.However, itšs possible to scroll the top half down and the bottom half up at the same time: 20000 REM Title screen #5 20050 SCREEN COPY 11 TO PHYSIC:WAIT 100 20060 FOR a=1 TO 100 20070 SCREEN COPY 10,0,100-A,320,100 TO PHYSIC,0,0 20080 SCREEN COPY 10,0,100,320,100+a TO PHYSIC,0,200-a 20090 NEXT a 20100 GOTO 20100 SCROLLING TEXT You may have noticed that there is a blank area near the bottom of the screen and a screenful of text has been unused.These last two routines will scroll the text within this blank area,first horizontally and then vertically. To save time Išll simply copy the title picture on to the screen instead of using some of the fancier techniques we have covered: 20000 REM Title screen #6 20050 SCREEN COPY 10 TO PHYSIC:SCREEN COPY PHYSIC TO BACK 20060 FLASH 14,"(777,5)(666,5)(555,5)(444,5)(333,5)(222,5)(111,5) (222,5)(333,5)(444,5)(555,5)(666,5)(777,5)" 20070 FOR a=0 TO 11 20080 FOR b=-320 TO 320 20090 SCREEN COPY 11,b,a*16,b+320,(a+1)*16 TO PHYSIC,0,164 20100 WAIT VBL 20110 NEXT b:NEXT a 20120 GOTO 20120 The scrolling text effect is produced with lines 20070 to 20110. Each time around the loop a block of 320 pixels wide is copied from bank 11 to the physical screen.The value of a indicates which line of text to display and b indicates where the 320 pixel block starts. Imagine we have two other blank screens by the left and right of bank 11.The SCREEN COPY command will use them to give the appearance of text moving on to the screen from the right side and disappearing off the left. You may be wondering how this works when the value of b is not a multiple of 16.The manual states it will be rounded down to the next lowest multiple,but this is not the case.Providing the width of the area to be copied is multiple of 16 the start and end values, (x1 and x2),can be anything at all. Sadly this typed text scrolling is not only slow,but can be tedious,especially when waiting for the next line to appear.An interesting way around this is to scroll the text vertically within the blank area of the screen,as shown in our final routine for this article: 20000 Title screen #7 20050 SCREEN COPY 10 TO PHYSIC:SCREEN COPY PHYSIC TO BACK 20060 FLASH 14,"(777,5)(666,5)(555,5)(444,5)(333,5)(222,5)(111,5) (222,5)(333,5)(444,5)(555,5)(666,5)(777,5)" 20070 FOR a=0 TO 192 20080 SCREEN COPY 11,0,a-16,320,a TO PHYSIC,0,164 20090 IF (a MOD 16)=0 THEN WAIT 100 20100 WAIT VBL 20110 NEXT a 20120 GOTO 20120 This works in a very similar way to the last program,except it is the vertical values,(y1 and y2),which are altered.Since the maximum height of each character is 16 pixels,line 20090 waits until the result of a divided by 16 is zero and then waits for two seconds. THE END!!