Does anyone see what is causing my collisions not to work? I'm trying to get my camera to collide with the cubes.
At first, I thought the issue might be happening, because the cubes were defined locally inside a loop, but then I tried just making one non-local cube and I still couldn't collide.
As far as I know, I am calling everything properly, but I am not super experienced with either minib3d or Monkey. Any help is appreciated, thanks.
Strict
Import mojo
Import minib3d
Global player:Int = 1
Global wall:Int = 2
Class Game Extends App
Field Camera:TCamera
Field Light:TLight, Light2:TLight
Field Floor:TEntity
Field Started:Bool
Field wallMesh:TEntity
Method OnCreate%()
SetUpdateRate 30
Return 0
End
Method OnUpdate%()
If Not Started Then Return 0
If KeyDown(KEY_UP)
Camera.MoveEntity 0,0,1
Elseif KeyDown(KEY_DOWN)
Camera.MoveEntity 0,0,-1
Endif
If KeyDown(KEY_LEFT)
Camera.TurnEntity 0,2.5,0
Elseif KeyDown(KEY_RIGHT)
Camera.TurnEntity 0,-2.5,0
Endif
Collisions(player, wall, 1, 2)
UpdateWorld()
Return 0
End
Method Init:Void()
If Started Then Return
Started = True
SetRender()
Camera = CreateCamera()
Camera.CameraClsColor(180,210,220)
Camera.MoveEntity 0,1.5,-10
Floor=CreateGrid(15,15)
Floor.ScaleEntity 10,1,10
Floor.PositionEntity -2,0,8
Floor.EntityColor 55,95,0
EntityType(Camera,player)
EntityRadius (Camera, 1.5)
For Local i%=0 To 11
Local C:TEntity=CreateCube()
C.MoveEntity Rnd(-50,50), 0,Rnd(-50,50)
C.EntityColor Rnd(255),Rnd(255),Rnd(255)
C.ScaleEntity Rnd(1,3), Rnd(6,12), Rnd(2,6)
EntityType(C, wall)
Next
Light=CreateLight(1)
Light.TurnEntity 35,-40,0
Light.LightColor 222,222,111
Light.AmbientLight 111,99,111
End
Method OnRender%()
Init()
RenderWorld()
Return 0
End
End
Function Main%()
New Game
Return 0
End
|