TGC Codebase Backup



Vertical Distortion by Richard Davey

25th Sep 2003 19:37
Summary

This sine-waves a 640x480 BMP but vertically, not horizontally!



Description



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    `	------------------------------------------------------------------------
`	Vertical Distortion                        DarkForge Snippet (17/8/2000)
`	------------------------------------------------------------------------
`	This sine-waves a 640x480 BMP but vertically, not horizontally!

sync rate 0
sync on
hide mouse

load bitmap "sanctuary_by_thomas.bmp",1
create bitmap 2,640,480

set current bitmap 1
for i=1 to 639
	get image i,i,0,i+1,479
next i

set text opaque
ink rgb(255,255,255),0

`	Change these values to alter the distortion effect
`	Uncomment a step line for a different style

`	Small waveform, slow, smooth
`step=2 : sx=0 : speed=2

`	Typical demo effect speed/wave :)
step=3 : sx=0 : speed=8

`	Lots of fast ripples!
`step=8 : sx=0 : speed=4

`	One large fast ripple
`step=2 : sx=0 : speed=16

do

	set current bitmap 2

`	The CLS is optional, if you comment it out you get a quite cool
`	pixel-drag effect on the sides of the screen - try it and see!

	cls 0

	for i=1 to 639
		paste image i,i,sin(sx+i*step)*25
	next i

	inc sx,speed

`	Uncomment to show fps
`	text 0,0,str$(screen fps())

	set current bitmap 0
	copy bitmap 2,0

	sync

loop