you were rotating the x axis by the mousex and y axis by mouse y. try changing the x axis by mousemovey() and y axis by mousemovex(), like this snippet:
sync on
sync rate 0
cls
hide mouse
make matrix 1,1000,1000,10,10
position camera 500,50,500
cam_move#=0
do
gosub camera_control
sync
loop
camera_control:
rotate camera wrapvalue(camera angle x()+mousemovey()),wrapvalue(camera angle y()+mousemovex()),0
if mouseclick()<>0
inc cam_move#,0.1
if mouseclick()=1 then move camera cam_move# else move camera 0-cam_move#
else
cam_move#=0
endif
return
if you change a few things, you can also have mouse sensitivity and the mouse invert like in most fps games:
sync on
sync rate 0
cls
hide mouse
make matrix 1,1000,1000,10,10
position camera 500,50,500
cam_move#=0
sensitivity#=0.2
mouse_invert=0
do
set cursor 0,0
gosub camera_control
print "press space to have a mouse invert like in fps games"
print "mouse sensitivity = ",sensitivity#," press up/down to change sensitivity of mouselook"
print "click mouse to move forward and backward"
`toggle mouse invert
if spacekey()=1 and space=0 then mouse_invert=1-mouse_invert
space=spacekey()
`adjust mouse sensitivity
sensitivity#=sensitivity#+(upkey()-downkey())*0.01
if sensitivity#<0.1 then sensitivity#=0.1
sync
loop
camera_control:
if mouse_invert=0
rotate camera wrapvalue(camera angle x()+mousemovey()*sensitivity#),wrapvalue(camera angle y()+mousemovex()*sensitivity#),0
else
rotate camera wrapvalue(camera angle x()-mousemovey()*sensitivity#),wrapvalue(camera angle y()+mousemovex()*sensitivity#),0
endif
if mouseclick()<>0
inc cam_move#,0.1
if mouseclick()=1 then move camera cam_move# else move camera 0-cam_move#
else
cam_move#=0
endif
return
here is the code you posted, but fixed, if you want to see what needed to be changed. I recommend you don't have commands that are screen res specific, in case you ever want to have different screen resolutions(the two snippets above should work at every resolution your computer can support). Note: I added 5 lines of code to your snippet to set the screen res, sync stuff, and a matrix to judge the rotation to.
sync on
sync rate 0
set display mode 800,600,16
make matrix 1,1000,1000,10,10
position camera 500,50,500
position mouse 400,300
do
set cursor 0,0
herolook = 0
herolook = wrapvalue(herolook)
herox = 0
heroy = 0
heroz = 0
camerax = camera position x()
cameray = camera position y()
cameraz = camera position z()
mouselookx = -400 + mousex()
mouselooky = -300 + mousey()
position mouse 400,300
cameralookx = camera angle x() + mouselooky
cameralookx = wrapvalue(cameralookx)
cameralooky = camera angle y() + mouselookx
cameralooky = wrapvalue(cameralooky)
rotate camera cameralookx,cameralooky,0
print "Mouse X:"; mouselookx
print "Mouse Y:"; mouselooky
sync
loop
-----------------------------------
To delete the bug, delete the code.
Specs: Sony VAIO Laptop, Windows XP, P4 2.8Ghz, 512MB RAM, ATI Radeon 64MB video memory, DBP Upgrade 5.3.