Basic 2D Wavey Sea?

Blitz3D Forums/Blitz3D Beginners Area/Basic 2D Wavey Sea?

I seem forgot how to do them...using Cos or sin for rect commands to make 2D Wavey Sea.

could anyone tell me how to do it please?

you mean a wavey sea like side on or bird's eye view?

you could always use an animation for it rather than program it. I've never needed to make water so i dont know.

ups, i read 3d waves, sorry

Side on - you all seen the Worm game that show wavey sea and I would like to know how do that

Worms is done using several animated images.

Using rects is ugly and slow as you can see from this quick example ...

Graphics 640,480,32,1

Global WATERloop = 0
Global WATERheight = 10
Const WATERstep = 2

While Not KeyDown(1)

	SetBuffer BackBuffer()
	Cls
	Color 50,50,250
	For x = 0 To 639-WATERstep Step WATERstep
		y = 240 + WATERheight * Sin( WATERloop ) * Sin( 5.0 * x )
		Rect x, y, WATERstep, 400,1
	Next
	WATERloop = ( WATERloop + 10 ) Mod 360
	
	Flip
	
Wend


thank you very much Stevie G :)

Graphics 640,480,16,1
Global count1,count2
; set up the background image
Global background=CreateImage (640,480)
SetBuffer ImageBuffer(background)
Color 0,100,200
Rect 0,0,640,240,1
Color 0,0,255
Rect 0,240,640,240,1
; set up the wave-image
Global waveimage=CreateImage(10,200)
SetBuffer ImageBuffer(waveimage)
Color 0,100,200
Rect 0,0,1,100,1
Color 0,0,255
Rect 0,100,1,100,1
; make sinus-table
Dim sinustable1(2000)
Dim sinustable2(2000)
 For a=1 To 2000
  sinustable1(a)=Sin(a)*45
  sinustable2(a)=Cos(a)*15
 Next
; back to the work-buffers
SetBuffer BackBuffer()
; loop
While Not KeyDown(1)
DrawBlock background,0,0
wave
Flip
Wend
End
;-----------
Function wave()
 b=0
 For a=0 To 640
  DrawImage waveimage,a,140+sinustable1(a+count1)+sinustable2(b+count2)
  b=b+2
 Next
count1=(count1+3) Mod 360
count2=(count2+1) Mod 360
End Function

found in the archives.
http://www.blitzbasic.com/codearcs/codearcs.php?code=292