ok, i've made little bit, i'm not sure if its the best way, but it works
look at this code, its your code with my rotation thing in it
Rem Project: weapontest
Rem Created: Sunday, May 24, 2009
Rem ***** Main Source File *****
Sync On : Sync Rate 0 : set display mode 1280, 800, 32
set window off
Do
if Button(20,55,"New Game")=1 then Goto New_Game
Button(20,95,"Load Game")
If Button(20,135,"Exit")=1 then End
sync
loop
New_Game:
sync
hide mouse
`load object "media\Template Body 2.x", 1
make object cube 1, 10
position object 1, 10, 10, 10
xpos#=object position x(1)
ypos#=object position y(1)
zpos#=object position z(1)
loop object 1
`load object "media\Template Body 1.x", 7
clone object 7, 1
position object 7,30, 1, 50
`scale object 1, 40, 40, 40
`load object "media\house.3ds", 2
`load object "media\house.3ds", 3
clone object 2, 7
clone object 3, 7
position object 3, 50, 1, 30
ink rgb(rnd(255),rnd(255),rnd(255)), 0
box 0, 0, 50, 50
get image 5, 0, 0, 50, 50
get image 6, 0, 0, 50, 50
`load image "media\tmp27.jpg", 5
`load image "media\tmp27.jpg", 6
texture object 2, 5
position object 2,0,1, 140
scale object 2, -800, -400, -800
rotate object 2, 0,0,180
make matrix 1,800,800,5,5
Position Matrix 1,-100,0,-100
prepare matrix texture 1, 5, 5, 5
movespeed = 75
turnspeed = 87.5
time=timer()
Ang# = 270
CamYPos# = 130
Do
gameTime=timer()-time
MSframe#=gameTime*(movespeed/1000.0)
TSframe#=gameTime*(turnspeed/1000.0)
If Upkey()=1
Move Object 1,MSframe#
endif
If Downkey()=1
Move Object 1,-MSframe#
endif
If Leftkey()=1
Dec a#,TSframe#
endif
If Rightkey()=1
Inc a#,TSframe#
endif
yrotate object 1,a#
posy#=object position y(1)
posx#=cos(Ang#-a#) * 90 + object position x(1)
posz#=sin(Ang#-a#) * 90 + object position z(1)
Position Camera posx#,object position y(1)+CamYPos#,posz#
Point Camera object position x(1),object position y(1),object position z(1)
move camera mousez()/5
if MouseClick()=4
dec Ang#, MouseMoveX()/5
dec CamYPos#, MouseMoveY()/5
endif
Ang# = Wrapvalue(Ang#)
time=timer()
set cursor 0,0
print mousemovey()
print mousemovex()
sync
Loop
end
function Button(x1,y1,WORDS$)
Pressed=0
x2=Text Width(WORDS$)
y2=Text Height(WORDS$)
if mousex()>x1 and mousex()<x1+x2
if mousey()>y1-y2 and mousey()<y1+y2
Pressed=1
endif
endif
if pressed=1 then ink rgb(255,0,0),0 else ink rgb(255,255,255),0
if pressed=1
Pressed=Mouseclick()
else
pressed = 0
endif
text x1,y1,WORDS$
endfunction pressed
what you might now is that the place were the Ang# variable is now, first was a value. that was 270. that meant that the camera was positioned directly behind the player. so by altering that value, you can rotate the camera!
and were the CamYPos# variable is now, first was a value too. that value was 130. if you change that value, the camera will go up or down.
and what i do here:
if MouseClick()=4
dec Ang#, MouseMoveX()/5
dec CamYPos#, MouseMoveY()/5
endif
i check if the middle mouse button is being pressed, if it is, it decreases the Ang# and CamYPos# values the amount of movement the mouse makes, and that way you can Orbit the Camera!