Microsoft Small Basic

Program Listing:
' Challenge of the month September 2012 Wave by NaochanON

gui()
shipimage()
while "true"
MM=MM+1
wave()
Program.Delay(20)
endwhile

Sub wave
For NN=-10 To 280
If NN=90 Then                                   ' ship position
shpy= Shapes.GetTop(rect[NN])-SH/2
shpx= Shapes.GetLeft(ship)
GraphicsWindow.Title=" Wave height = "+(300-(shpy+SH))
shpy2= Shapes.GetTop(rect[NN+SW/DP])-SH/2
angle= Math.GetDegrees(Math.ArcTan((shpy2-shpy)/SW))  ' get angle of ship
shipmoving()
EndIf
endfor
EndSub

Sub gui
GraphicsWindow.Hide()
GraphicsWindow.BackgroundColor="lightcyan"
GraphicsWindow.Width=1200
GraphicsWindow.Height=500
GraphicsWindow.BrushColor="Blue"
GraphicsWindow.PenColor="Blue"
DP=5                                     ' wave pitch
For I=-10 To 280
If i=90 Then
shpX= Shapes.GetLeft(rect[I])       ' ship position
shpy= Shapes.Gettop(rect[I]) -SH/2
EndIf
EndFor
EndSub

Sub shipimage
' ------------------- ship image ----------------------------------
sW=100           ' ship length
sH=20           ' ship height
tW=6            ' head or trail triangle width
tH=sH-6          ' head or trail triangle height
GraphicsWindow.BrushColor="darkgreen"
GraphicsWindow.PenColor="darkgreen"
GraphicsWindow.BrushColor="lightcyan"
GraphicsWindow.PenColor="Red"
For i=1 To 6
EndFor
angle=0
shipmoving()
GraphicsWindow.Show()
EndSub

Sub shipmoving
Shapes.Move(tri1,shpX,shpY)
Shapes.Move(tri2,ShpX,shpY)
Shapes.Move(ship,ShpX,ShpY)
Shapes.Rotate(ship,angle)
Shapes.Rotate(tri1,angle)
Shapes.Rotate(tri2,angle)
For i=1 To 6