Why doesn't this simple code works? It's supposed to create a new cube and place it where the "mouse-cube" is when i press the left mouse button. But it doesn't :S
Graphics3D 640,480,16,2
SetBuffer BackBuffer()
Type cube
Field x,y,z,rot#,entity
End Type
fixedy = 0
cube = CreateCube()
camera = CreateCamera()
light = CreateLight()
PositionEntity camera, 0, 5, -20
RotateEntity camera, 20,0,0
CameraClsColor camera, 0, 0, 255
MoveMouse 320,240
While Not KeyHit(1)
Cls
If(posdone = False)
MoveEntity cube, MouseXSpeed()/10, 0, -MouseYSpeed()/10
MoveMouse 320,240
EndIf
If(MouseHit(1) And posdone = False And sizedone = False And rotdone = False)
c.cube = New cube
c\x = EntityX(cube)
c\y = EntityY(cube)
c\z = EntityZ(cube)
c\entity = CreateCube()
PositionEntity c\entity, c\x, 0, c\z
lastcube = c\entity
posdone = True
HideEntity(cube)
EndIf
UpdateWorld()
RenderWorld()
Flip
Wend
|