TGC Codebase Backup



Raster Carpet by Richard Davey

25th Sep 2003 19:44
Summary

30 Vertical "rasters" sine-waving against a starfield and logo. Uses a BMP for the rasters because I'm too lazy to generate with code :)



Description



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    `	------------------------------------------------------------------------
`	Raster Carpet                              DarkForge Snippet (6/10/2000)
`	------------------------------------------------------------------------
`	30 Vertical "rasters" sine-waving against a starfield and logo.
`	Uses a BMP for the rasters because I'm too lazy to generate with code :)

hide mouse
sync rate 0
sync on

load image "bars2a.bmp",100

for a=0 to 480
	paste image 100,0,a
next a

for a=0 to 29

`	this version does a pointed wave
	get image 1+a,a*16,a*2,(16*a)+16,480-(a*2)

`	this version is full height, but missing the tops
`	get image 1+a,a*16,a*2,(16*a)+16,480

next a

`	Play with the speed value for some cool stuff :)

step=3 : sx=0 : speed=3

`	Make our little star graphic

ink rgb(0,255,255),0 : dot 1,1
ink rgb(100,50,155),0 : dot 1,0 : dot 1,2 : dot 0,1 : dot 2,1
get image 100,0,0,3,3

cls 0

`	Draw a little logo

set text font "Terminal"
set text size 12
i=6
for a=50 to 255 step 50
	ink rgb(a,a,a),0
	text i,0,"DarkForge.co.uk"
	dec i
next a
get image 101,0,0,125,16

`	Starfield code

n=75
dim x(n,3)

for i=1 to n
	x(i,1)=rnd(639)+1
	x(i,2)=rnd(479)+ 1
	x(i,3)=rnd(9)+1
next i

`	The main loop

create bitmap 1,640,480

do

	cls 0

	paste image 101,0,0

	for i=1 to n

		x(i,1)=x(i,1)-x(i,3)
		
		if x(i,1)<=1
			x(i,1)=640
			x(i,2)=rnd(479)+1
		endif
	
		paste image 100,x(i,1),x(i,2)
	
	next i

	for a=1 to 30
		paste image a,290+sin(sx+(a*step*2))*150,a*2
	next a

	inc sx,speed

	copy bitmap 1,0
	sync

loop