//basic stuff
sync on
phy start
sync rate 30
ai start
make camera 1
set window size 1024,780
deskx = desktop width()
desky = desktop height()
set window position deskx / 6, desky / 8
//player
make object cube 1,20
position object 1,0,0,0
phy make box character controller 1,0,0,0,10,10,10, 1, 10.5, 45.0
//other (make)
make object cube 2,20
//other (position)
position object 2,40,0,0
//other (physics)
phy make rigid body static box 2
do
//Camera position and getting player X,Y,Z and rotation
rotation = object angle z(1)
x = object position x(1)
z = object position z(1)
y = object position y(1)
position camera 1,x,y,z+120
point camera 1,x,y,z
//movement keys
if (keystate(200) = 1)
phy move character controller 1,2
endif
if (keystate(208) = 1)
phy move character controller 1,-2
endif
if (keystate(203) = 1)
rotation = rotation - 3
endif
if (keystate(205) = 1)
rotation = rotation + 3
endif
//set player to it's rotation
rotate object 1,0,0,rotation
//sync
phy update
sync
loop
I'm trying to make it so left and right arrow keys rotate my player, up makes him go forward the way it's facing, and back to go backwards the way it's facing.
Right no matter how rotated I am, or if I press up or down my player only goes one way. What's wrong with this? I was told that to move a CC you need to rotate it then set it's speed to move. Apparently that's not so, or I'm not doing it right
Always program as if the person maintaining your program is a psychopath that knows where you live