Here is a code snippet you may find useful. Simply call it once per frame and it does all the hard work for you and looks cool! I know it can be optimised (based on the Fade Screen Speed Challenge topic) but it works for now. Try it on a medium bitmap saying something like "Game Over", it's cool.
You can modify Wave Speed before you ever call the function. I recommend value of 3!
You can modify Wave Speed before you ever call the function. I recommend value of 3!
; ----------------------------------------------------------------------------- ; ccImageVerticalWave ; ----------------------------------------------------------------------------- Global ccStartDegree = 0 Global ccWaveSpeed = 1 Function ccImageVerticalWave(img%, ox, oy, amp) ; amp = amplitude (height of wave) ;modify an image so that it waves up and down using sin LockBuffer ImageBuffer(img%) LockBuffer BackBuffer() Local x,y For x = 0 To ImageWidth(img%)-1 ;workout y offset off = Sin(ccStartDegree+x)*amp For y = ImageHeight(img%)-1 To 0 Step -1 WritePixelFast(ox+x, oy+y+off, ReadPixelFast(x,y, ImageBuffer(img%)), BackBuffer()) Next Next ccStartDegree = ccStartDegree + ccWaveSpeed If StartDegree > 360 Then StartDegree = StartDegree - 360 UnlockBuffer ImageBuffer(img%) UnlockBuffer BackBuffer() End Function