I didn't mean "strafe" as a command per se, i meant write code that actually strafes
here is some strafing code from an fps test I was working on. Have fun stripping out what you need (Kidsa)
Rem Project: BSP TEST
Rem Created: 8/13/2003 17:45:36
REM 3dsmax with grid=1.87/generic units gets 1:1 with VHE3.4
REM Space bar exits, ctrl key centers mouse, mouselook, arrow keys move,
REM right-click jump, left-click Pick Object
set display mode 1024,768,32
sync on : sync rate 100
backdrop off
center text screen width()/2,screen height()/2,"LOADING, PLEASE WAIT..."
sync
load bsp "","new1.bsp"
`load bsp "","t7g_real.bsp"
set bsp camera 0
set camera range 1,3000
autocam off
`\DUMMY OBJECTS (1 for bsp col, 2 for other col)
make object cube 1,.5
position object 1,0,-1,0
make object cube 2,.5
position object 2,0,1.1,0
`\Collision
set bsp object collision 1,1,2,1
automatic object collision 2,1,1
`\hide dummies and set camera
hide object 1
hide object 2
set camera to object orientation 0,2
hide mouse
`load object "box.3ds", 3
`position object 3,0,-2,0
`automatic object collision 3,2,1
`//hid this object to see if PickObject still works - It does!
`//this means we can do node-driven movement like T7G...muwhaahaaahaa
`hide object 3
`now for the cursor change to indicate hot-spot or node....
`\-------------------------------------------------------
intMouse as integer
intPickObject as integer
intCollided as integer
`\-------------------------------------------------------
do
`\Mouselook
rotate object 1, object angle x(1)+(mousemovey()/2.75),object angle y(1)+(mousemovex()/2.75),0
rotate object 2, object angle x(1)+(mousemovey()/2.75),object angle y(1)+(mousemovex()/2.75),0
intCollided=object collision(2,0)
if upkey()=1 and intcollided > 0
`?
endif
if downkey()=1 and intcollided > 0
`?
endif
if leftkey()=1 and intcollided > 0
`?
endif
if rightkey()=1 and intcollided > 0
`?
endif
`\move player with arrow keys (objects 1 & 2)
cx#=object angle x(1) : cy#=object angle y(1)
dx#=object angle x(2) : dy#=object angle y(2)
if upkey()=1
xrotate object 1,0 : move object 1,0.15 : xrotate object 1,cx#
xrotate object 2,0 : move object 2,0.15 : xrotate object 2,dx#
endif
if downkey()=1
xrotate object 1,0 : move object 1,-0.15 : xrotate object 1,cx#
xrotate object 2,0 : move object 2,-0.15 : xrotate object 2,dx#
endif
if leftkey()=1
yrotate object 1,cy#-90 : move object 1,0.15 : yrotate object 1,cy#
yrotate object 2,dy#-90 : move object 2,0.15 : yrotate object 2,dy#
endif
if rightkey()=1
yrotate object 1,cy#+90 : move object 1,0.15 : yrotate object 1,cy#
yrotate object 2,dy#+90 : move object 2,0.15 : yrotate object 2,dy#
endif
`\camera follows dummy object 2
position camera 0,object position x(2),object position y(2),object position z(2)
rotate camera 0,object angle x(2),object angle y(2),object angle z(2)
rem Apply gravity to player / offset object 2 by 2.1 point
position object 1,object position x(1),object position y(1)-0.1,object position z(1)
position object 2,object position x(1),object position y(1)+2,object position z(1)
`\------------------------------------------------------------------------------------
`\re-center mouse on screen (for picking objects)
if controlkey()=1 then position mouse screen width()/2,screen height()/2
`\ check for mouse value
intMouse=mouseclick()
`\ left click Get PICK OBJECT value
if intmouse=1
intpickobject=pick object(mousex(),mousey(),3,5)
endif
`\ right click Simple Jump
if intMouse=2
for intLoop= 1 to 35
position object 1, object position x(1),object position y(1)+0.1,object position z(1)
position object 2, object position x(2),object position y(2)+0.1,object position z(2)
position camera 0,object position x(2),object position y(2),object position z(2)
rotate camera 0,object angle x(2),object angle y(2),object angle z(2)
gosub UpdateScreenXYZ
sync
next intLoop
endif
`\ Space Key ENDS demo
if spacekey()=1
sync
center text screen width()/2,screen height()/2,"ENDING GAME, PLEASE WAIT..."
sync
delete object 1
delete object 2
delete bsp
end
endif
`\show coordinates on screen
gosub UpdateScreenXYZ
sync
loop
UpdateScreenXYZ:
set cursor 0,0
print "x:";str$(int(object position x(1)));" y:";str$(int(object position y(1)));" z:";str$(int(object position z(1)))
set cursor 0,15
print "PickObj#: ";str$(intPickObject)
set cursor 0,30
print "2 Col With: ";str$(intcollided)
Return
Home of the VB.NET Class Builder Utility - Demo and FULL versions now available!!