Указатель Follow Mouse (Blitz Basic, Blitz 3d)

В моей программе Blitzbasic, как указано ниже, я все делаю для простой прогулки и просмотра мышью FPS. Однако, когда я попытался сделать перекрестие, которое следовало за мышью, я потерпел неудачу по неизвестной причине.

AppTitle "Colby's FPS"
Graphics3D 800,600,64,2
SetBuffer BackBuffer()
SeedRnd MilliSecs()
;HidePointer

;OBJECTS
Global crosshairs = LoadImage("crosshairs.bmp")
Global camera = CreateCamera()
Global cube = CreateCube()
Global light = CreateLight()

;OBJECT SPECS
MaskImage crosshairs,0,0,0
MidHandle crosshairs
PositionEntity camera,50,0,50
PositionEntity cube,50,0,45
PositionEntity light,0,10,0

;CALLED FUNCTIONS
While Not KeyHit(1)
;Cls
;Crosshair Follow
DrawImage crosshairs,20,20
;Camera Rotate
mxs# = mxs# + MouseXSpeed()
If mxs# > 360 Then mxs# = 0
If mxs# < 0 Then mxs# = 360
RotateEntity camera,0,-mxs#,0

RenderWorld()
UpdateWorld()
cameraCtrl()
Flip
Wend
End

;FUNCTIONS
Function cameraCtrl()
If KeyDown(208)
MoveEntity camera,0,0,-0.2
ElseIf KeyDown(200)
MoveEntity camera,0,0,0.2
ElseIf KeyDown(203)
MoveEntity camera,-0.2,0,0
ElseIf KeyDown(205)
MoveEntity camera,0.2,0,0
EndIf
If KeyDown(31)
MoveEntity camera,0,0,-0.2
ElseIf KeyDown(17)
MoveEntity camera,0,0,0.2
ElseIf KeyDown(30)
MoveEntity camera,-0.2,0,0
ElseIf KeyDown(32)
MoveEntity camera,0.2,0,0
EndIf

1 ответ

Я думаю, что вы имеете в виду центрирование мыши при вращении.

В этом случае поставьте эту строку перед RenderWorld():

...
MoveMouse GraphicsWidth() / 2, GraphicsHeight() / 2   <-----------
RenderWorld()
UpdateWorld()
...
Другие вопросы по тегам