DarkRipples by Richard Davey29th Sep 2003 14:03
|
---|
Summary Vertically ripples a 640x480 2D image with an almost water like effect Description Code ` This code was downloaded from The Game Creators ` It is reproduced here with full permission ` http://www.thegamecreators.com ` ------------------------------------------------------------------------ ` DarkRipples DarkForge Snippet (10/2/2001) ` ------------------------------------------------------------------------ ` Vertically ripples a 640x480 2D image with an almost water like effect sync rate 0 sync on hide mouse load bitmap "tmk-blue.bmp",1 create bitmap 2,640,480 set current bitmap 1 for i=1 to 480 get image i,0,i-1,640,i next i ` Change the waves and speed values for smoother/faster waves step#=3 : sx=0 : speed=3 : waves = 10 ` Makes the little graphic at the bottom cls 0 set text font "Terminal" set text size 14 set text to bold ink rgb(10,10,10),0 center text 320,446,"- DarkForge 2001 -" center text 320,460,"Press cursor keys to change wave pattern" ink rgb(255,255,255),0 center text 321,447,"- DarkForge 2001 -" center text 321,461,"Press cursor keys to change wave pattern" get image 500,200,446,450,479 ` The main loop - it's just another sine wave trick basically do set current bitmap 2 for i=1 to 480 paste image i,0,i+sin(sx+i*step#)*waves next i inc sx,speed if upkey() then step#=3 : speed=3 : waves=10 if downkey() then step#=1.5 : speed=4 : waves=16 if leftkey() then step#=3 : speed=6 : waves=10 if rightkey() then step#=0.5 : speed=2 : waves=14 paste image 500,200,446,1 copy bitmap 2,0 sync loop |