TGC Codebase Backup



Vertical Credits Scroller by Richard Davey

29th Sep 2003 14:03
Summary

Scroll text vertically up the screen, ala film credits. Resolution independant, doesn't require graphics files.



Description



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    `	------------------------------------------------------------------------
`	Vertical Credits Scroller                  DarkForge Snippet (14/1/2001)
`	------------------------------------------------------------------------
`	Scroll text vertically up the screen, ala film credits.
`	Resolution independant, doesn't require graphics files.

hide mouse
sync rate 0
sync on

load image "tmk-blue.bmp",50

set text font "Times New Roman"
set text size 18

sw = screen width()
sh = screen height()

max_lines = sh / 20

ink rgb(255,255,255),0

create bitmap 1,sw,sh
create bitmap 2,sw,sh

MakePage(1,max_lines,sw)
MakePage(2,max_lines,sw)

y1# = 480 : y2# = 960

speed# = 0.5

set current bitmap 0

`	3D stuff here

make object box 1,25,25,25
color object 1,rgb(0,0,100)
texture object 1,50
autocam off
color backdrop 0
set ambient light 25

do

	set cursor 0,0 : print screen fps()

	paste image 1,0,y1#,1
	paste image 2,0,y2#,1

	dec y1#,speed#
	dec y2#,speed#

	if y1# <= -480
		MakePage(1,max_lines,sw)
		y1# = 480
	endif

	if y2# <= -480
		MakePage(2,max_lines,sw)
		y2# = 480
	endif

	xrotate object 1,wrapvalue(ox#*2)
	yrotate object 1,wrapvalue(ox#)
	zrotate object 1,wrapvalue(ox#)
	inc ox#,0.5

	sync

loop

`	- DF Function --------------------------------------------------------
`	This creates the next screen worth of text
`	-------------------------------------------------------- DF Function -

function MakePage(b,max_lines,sw)

	set current bitmap b

	cls

	y = 0

	for a = 0 to max_lines

		read temp$

		if temp$="*"
			restore scrolltext
			read temp$
		endif

		ink rgb(10,10,10),0
		center text sw/2,y,temp$
		ink rgb(255,255,255),0
		center text sw/2+1,y+1,temp$

		inc y,20

	next a

	get image b,0,0,screen width(),screen height()

	set current bitmap 0

`	- DF Data ------------------------------------------------------------
`	The actual data, terminate with an asterisk * on its own
`	------------------------------------------------------------ DF Data -

scrolltext:

	data " "
	data " "
	data " "
	data "DARKFORGE"
	data "presents"
	data " "
	data "An R.Davey Production"
	data " "
	data "A DarkBASIC Film"
	data " "
	data " "
	data "- C R E D I T   +   S C R O L L E R -"
	data " "
	data " "
	data "Staring"
	data " "
	data "Byte-Zero"
	data " "
	data "DataBank"
	data " "
	data "Calculus"
	data " "
	data " "
	data " "
	data " "
	data "This is a credits scroller"
	data "coded for a DB forum request"
	data "and just because I felt"
	data "like it."
	data " "
	data " "
	data " "
	data " "

	data "*"

endfunction