// Project: FPSTest
// Created: 2015-04-05
// set window properties
SetWindowTitle( "FPSTest" )
SetWindowSize( 640, 480, 0 )
// set display properties
SetVirtualResolution( 640, 480 )
SetOrientationAllowed( 1, 1, 1, 1 )
SetVSync(1)
grass = LoadImage("grass.png")
ground = CreateObjectPlane(128,128)
RotateObjectGlobalX(ground, 90)
SetObjectImage(ground, grass, 0)
player = CreateObjectBox(2,6,2)
SetObjectPosition(player, 0,3,0)
SetCameraRotation (1,0,0,0)
speed#=.1
do
if GetRawKeyState(87) = 1
MoveObjectLocalZ(player,speed#)
endif
if GetRawKeyState(83) = 1
MoveObjectLocalZ(player,-speed#)
endif
if GetRawKeyState(65) = 1
MoveObjectLocalX(player,-speed#)
endif
if GetRawKeyState(68) = 1
MoveObjectLocalX(player,speed#)
endif
if GetRawKeyState(27) = 1
end
endif
mx#=GetPointerX()-320
my#=GetPointerY()-240
xmove#=xmove#+(mx#)
ymove#=ymove#+(my#)
if ymove#<-800
ymove#=-800
endif
if ymove#>800
ymove#=800
endif
SetCameraRotation(1, ymove#/16, xmove#/16,0)
SetObjectRotation(player, GetObjectAngleX(player), GetCameraAngleY(1), GetObjectAngleZ(player))
SetCameraPosition(1, GetobjectX(player), getobjectY(player), getobjectz(player))
SetRawMousePosition(320,240)
Sync()
loop
All works fine A,S,D,W movement but if i try to rotate to mouse nothing works...
Why?