This is about all I can do with my shabby self. Have fun lol.
Arrows to control and mouse to look around.
Graphics3D 1024,768,32,2
SetBuffer BackBuffer()
SeedRnd MilliSecs()
light=CreateLight()
AmbientLight 100,100,100
Global boatpiv=CreatePivot()
PositionEntity boatpiv,0,700,0
Global boat = CreateCube(boatpiv)
ScaleMesh boat,8,4,16
PositionEntity boat,0,10,0
Global thrust#
Global roll#
Global planed
Global camera=CreateCamera(boat)
CameraRange Camera,1,100000
CameraZoom camera,1.6
PositionEntity camera,5,10,-5
Type buoy
Field mesh
End Type
buoy = CreateCube()
ScaleEntity buoy,4,16,4
HideEntity buoy
For i = 1 To 30
b.buoy = New buoy
b\mesh = CopyEntity (buoy)
EntityColor b\mesh,Rnd(0,255),Rnd(0,255),Rnd(0,255)
PositionEntity b\mesh,Rnd(-6000,6000),700,Rnd(-6000,6000)
EntityAutoFade b\mesh,6000,7000
Next
Type thing
Field mesh
End Type
thing = CreateCube()
ScaleEntity thing,120,120,120
For i = 1 To 10
t.thing = New thing
t\mesh = CopyEntity (thing)
RotateEntity thing,0,Rnd(1,100),45
EntityColor t\mesh,0,100,0
PositionEntity t\mesh,Rnd(-6000,6000),700,Rnd(-6000,6000)
EntityAutoFade t\mesh,6000,7000
Next
tex = CreateTexture ( 256, 256, 11 )
SetBuffer TextureBuffer ( tex )
For i = 0 To 4
Rect i, i, 256 - i - i, 256 - i - i, False
Next
For y = 5 To 250
For x = 5 To 250
WritePixel x, y, 0
Next
Next
SetBuffer BackBuffer ()
CameraClsColor camera,100,100,255
ground = CreatePlane()
PositionEntity ground,0,650,0
ScaleTexture tex,5,5
EntityTexture ground,tex
EntityFX ground,9
water = CreatePlane()
EntityColor water,56,200,56
EntityAlpha water,.8
PositionEntity water,0,700,0
MoveMouse GraphicsWidth()/2,GraphicsHeight()/2
Const FPS=60
period=1000/FPS
time=MilliSecs()-period
While Not KeyHit(1)
Repeat
elapsed=MilliSecs()-time
Until elapsed
ticks=elapsed/period
tween#=Float(elapsed Mod period)/Float(period)
For k=1 To ticks
time=time+period
KeyControl()
Next
RenderWorld()
mouselook(camera)
Text 10,40,EntityX(boatpiv)
Text 10,60,EntityY(boatpiv)
Text 10,80,EntityZ(boatpiv)
Text 5,130,"acc: "+thrust
Text 5,150,"planed: "+planed
Flip 0
Wend
End
Function mouselook(ent)
mxspd#=MouseXSpeed()*0.25
myspd#=MouseYSpeed()*0.25
MoveMouse GraphicsWidth()/2,GraphicsHeight()/2
campitch#=EntityPitch(ent)+myspd#
If campitch#<-85 Then campitch#=-85
If campitch#>85 Then campitch#=85
RotateEntity ent,campitch#,EntityYaw(ent)-mxspd#,-roll*4
End Function
Function KeyControl()
If KeyDown(200)
thrust = thrust + .06
EndIf
If KeyDown(208)
thrust = thrust - .04
EndIf
If thrust > 8 Then thrust = 8
If thrust < 0 Then thrust = 0
MoveEntity boatpiv,0,0,thrust
If KeyDown(203)
If roll < 5 Then roll# = roll + thrust * .004
Else If KeyDown(205)
If roll > -5 Then roll# = roll - thrust * .004
Else
roll = roll * .94
EndIf
If planed = True
RotateEntity boat,EntityPitch(boat)*.994,0,0
Else
RotateEntity boat,-thrust*1.6,0,0
EndIf
If thrust > 7.0
planed = True
Else If thrust < .5
planed = False
EndIf
RotateEntity boatpiv,0,EntityYaw(boatpiv)+(roll*.4),roll*6
TurnEntity boatpiv,Sin(MilliSecs()/5)/5,0,Cos(MilliSecs()/5)/5
For b.buoy = Each buoy
TurnEntity b\mesh,Sin(MilliSecs()/5)/8,0,Cos(MilliSecs()/5)/8
Next
If KeyHit(16)
PositionEntity camera,5,10,-5
Else If KeyHit(18)
PositionEntity camera,5,16,-5
EndIf
End Function