'************************************************
'** Moves the ship. The variable 'beec' is the main
'** variable that changes speed.
'************************************************
Sub moveship
sx = Math.Remainder(sx + (Math.Cos(Math.GetRadians(heading - 90)) * beec) + gameWidth, gameWidth)
sy = Math.Remainder(sy + (Math.Cos(Math.GetRadians(heading)) * beec) + gameHeight, gameHeight)
Shapes.Move(myship, sx, sy)
endsub
'************************************************
'** Generates wind direction and controls when
'** the wind changes direction
'************************************************
wdelay = 0
Sub getwind
wdelay = wdelay + 1
If wdelay = 1000 then
windhead = Math.Remainder(Math.GetRandomNumber(360), 360)
wdelay = 1
endif
endsub
'************************************************
'** Modifies the speed of the ship by calculating
'** the wind speed and direction
'************************************************
Sub calcmove
modspeed = math.abs(savesarr - savewarr)
beec = ((beec * dr[modspeed]) + .11)
endsub
'************************************************
'** narrows the 360 possible points of the
'** compas down to eight. This is used in run()
'** where run queries both the wind heading
'** and the ship heading.
'************************************************
Sub calcdir
If dirdeg < 45 then
dirreq = "sse"
dirarr = 4
endif
If dirdeg > 315 then
dirreq = "ssw"
dirarr = 5
endif
If dirdeg < 90 and dirdeg > 45 then
dirreq = "se"
dirarr = 3
endif
If dirdeg < 135 and dirdeg > 90 then
dirreq = "ne"
dirarr = 2
endif
If dirdeg < 180 and dirdeg > 135 then
dirreq = "nne"
dirarr = 1
endif
If dirdeg < 225 and dirdeg > 180 then
dirreq = "nnw"
dirarr = 8
endif
If dirdeg < 270 and dirdeg > 225 then
dirreq = "nw"
dirarr = 7
endif
If dirdeg < 315 and dirdeg > 270 then
dirreq = "sw"
dirarr = 6
endif
endsub
'************************************************
'** Listen for keystrokes
'************************************************
Sub getcommand
If(GraphicsWindow.LastKey = "Up") Then
getgoing = 1
EndIf