B2D wave image.

BlitzPlus Forums/BlitzPlus Programming/B2D wave image.

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

This is my final one. I learnt what I wanted to learn so here it is for the rest of you.

Hope it helps Reno , thanks for the tip Skully and check it out Floyd..

;)

;
;	Demo Wave Image
;
;	By Yavin @ Team Rebellion Software
;	Yavin@...
;	www.teamrebellion.co.uk
;
;	I this small chunk of code will help all of those coders out there
;	who have been wanting to make some Demo type stuff but havent been
;	able to work out the wave thing.
;
;
;	All I ask is that if you improve the code coudl you re post so we
;	can all learn from it.



Graphics 800,600,16
SetBuffer BackBuffer()
Cls


Global image=LoadImage("yavin.bmp")
Global Width,height
width=ImageWidth(image)
height=ImageHeight(image)
FreeImage image

Global horz=LoadAnimImage("yavin.bmp",width,1,1,height-1)
Global vert=LoadAnimImage("yavin.bmp",1,height,1,width-1)



Global wave#,amp#,slice,render_mode
slice=1
wave=.2
amp=8
render_mode=1


;Main
While Not KeyHit(1)
Cls
	update()
	render()
Flip
Wend


Function update()
	wave=wave+6

	If KeyHit(57)
		render_mode=render_mode+1
	End If

	If KeyDown(200);up
		amp=amp+1
	End If
	If KeyDown(208);down
		amp=amp-1
	End If
	If KeyDown(203);left
		wave=wave+1
	End If
	If KeyDown(205);right
		wave=wave-1
	End If			
End Function

Function render()

Select render_mode
	Case 1
		For looper=1 To height-2
			DrawImage horz,0+Sin(wave+looper)*amp,0+looper,looper
		Next
	Case 2
		For looper=1 To height-2 Step 2
			DrawImage horz,0+Sin(wave+looper)*amp,0+looper,looper
		Next
		For looper=2 To height-2 Step 2
			DrawImage horz,0-Sin(wave+looper)*amp,0+looper,looper
		Next
	Case 3
	
		For looper=1 To height-2 Step 2
			DrawImage horz,0+Sin(wave+looper)*amp,0+looper,looper
		Next
		For looper=2 To height-2 Step 2
			DrawImage horz,0+Sin(wave+looper)*(amp/2),0+looper,looper
		Next
		
		
		
	Case 4	
		For looper=1 To width-2
			DrawImage vert,0+looper,0+Sin(wave+looper)*amp,looper
		Next
	Case 5
		For looper=1 To width-2 Step 2
			DrawImage vert,0+looper,0+Sin(wave+looper)*amp,looper
		Next
		For looper=2 To width-2 Step 2
			DrawImage vert,0+looper,0-Sin(wave+looper)*amp,looper
		Next	
	Case 6
		For looper=1 To width-2 Step 2
			DrawImage vert,0+looper,0+Sin(wave+looper)*amp,looper
		Next
		For looper=2 To width-2 Step 2
			DrawImage vert,0+looper,0+Sin(wave+looper)*(amp/2),looper
		Next
	Case 7
		render_mode=1	
End Select
		
End Function