You need to base the sword's angle upon the camera's orientation. Change your Sword() function to this:
function sword()
if weapon=1
camx# = camera position x() : camy# = camera position y()
camz# = camera position z()
set object to camera orientation 14
position object 14,camx#,camy#,camz#
move object 14,3.3
move object right 14,0.8
endif
endfunction
and your MouseTarget() function to this:
function mousetarget()
mousetime=mousetime-1
if mouseclick()=2 and mousetime<0
if pick object(mousex(),mousey(),2,3)=2
if get pick distance()<10
if door1=1 then door1=2
if door1=0 then door1=1
endif
endif
if pick object(mousex(),mousey(),2,3)=3
if get pick distance()<10
if door2=1 then door2=2
if door2=0 then door2=1
endif
endif
if pick object(mousex(),mousey(),14,15)=14
if get pick distance()<10
weapon=1
x# = 35.0
y# = object angle y(14)
y# = wrapvalue(y# + 20.0)
z# = object angle z(14)
z# = wrapvalue(z# + 10.0)
rotate object 14,x#,y#,z#
fix object pivot 14
endif
endif
mousetime=mousetimemax
endif
endfunction
and it should look something like the attached pic.
I don't have enough time to help with the lighting issue. It seems like using shading on everything is going to kill your frame rate. Also, you should delete all of the objects, images, etc. upon leaving the game.
So many games to code......so little time.