Here's a resource cheap water effect I made some time ago
works pretty well, looks decent and is
extremely fast.
media attached.
Rem ***** Main Source File *****
`Cheap Water effect with no shaders v2
`Created by SH4773R
`Created 07/25/11 (DD/MM/YY)
`standard screen setup
sync on : sync rate 30
color backdrop rgb(0,0,0)
`setup ground (terrain) matrix
make matrix 1,100,100,10,10
position matrix 1,-50,0,-50
load image "ground.png",1
prepare matrix texture 1,1,2,2
randomize matrix 1,6
SQW_setup(2,2,"water.png",70,100,0,0,255)
`setup camera
position camera 0,10,-50
`mainloop
do
center text screen width()/2,0,"Simple Quick Water (SQW)"
center text screen width()/2,10, "Use arrow keys to move up/down"
`control camera depth w/ arrow keys
if upkey() then position camera camera position x(),camera position y()+0.1,camera position z()
if downkey() then position camera camera position x(),camera position y()-0.1,camera position z()
SQW_update(0)
`update matrix (can be used for dynamic maps)
update matrix 1
`Sync screen
sync
loop
end
function SQW_setup(objno as byte , waterlevel as integer, watertexture as string wateralpha as byte , size as integer ,r as byte ,g as byte ,b as byte )
global SQW_waterobject as byte
global SQW_waterlevel as float
global SQW_bobangle as integer
global SQW_R as byte
global SQW_G as byte
global SQW_B as byte
SQW_R = r
SQW_G = g
SQW_B = b
SQW_waterlevel = waterlevel
SQW_waterobject = objno
`setup water plane object
make object plane SQW_waterobject,size,size
position object SQW_waterobject,0,waterlevel,0
load image watertexture,SQW_waterobject
texture object SQW_waterobject,SQW_waterobject
rotate object SQW_waterobject,90,0,0
set object light SQW_waterobject,0
set alpha mapping on SQW_waterobject,wateralpha
`setup underwater fog
fog color rgb(r,g,b)
fog distance 25
endfunction
function SQW_update(camera as byte )
`detect depth of water and set water fog accordingly
if camera position y(camera) < object position y(SQW_waterobject)
fog color rgb(SQW_R,SQW_G,SQW_B)
fog on
else
fog off
endif
`water object effects
scroll object texture SQW_waterobject,0.001,0.002
position object SQW_waterobject,object position x(SQW_waterobject),cos(SQW_bobangle)/12+SQW_waterlevel,object position x(SQW_waterobject)
inc SQW_bobangle,2
endfunction
