Thanks for fast answers
Quote: "I can't get your code snippets to compile."
Whoops... I forget to post all the sourche files, my fault. Here is the rest of my the sourche files, I have allready worked a little bit further with my project, so I post the new code snippets, and attach a new media file
Rem Project: DARK MATTER
Rem Created: Saturday, December 07, 2013
Rem ***** Main Source File *****
Sync on
Sync rate 60
Autocam off
backdrop off
hide mouse
`Fog options
fog off
fog distance 85
fog color rgb(0,0,0)
`Light options
make light 1
set ambient light 20
color ambient light rgb(64,64,128)
set light range 1,40
set spot light 1,10,40
color light 1,4000,4000,0
Gosub Objects_Camera
Gosub Intialize_medias
Gosub Constants
do
` <<<<<<<<<<<<<<<<HERE IS THE PROBLEM>>>>>>>>>>>>>>>>>>>>>
rem set shadow position 1, object position x(3),0, object position z(3)
rem set shadow shading on 5,-1,10,1
` <<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Gosub MAIN_GAME_ENGINE
sync
loop
Intialize_medias:
Create animated sprite bg,"BILDER\bg.bmp", 1, 1, Image_bg
load image "BILDER\oldpaper.png",66,
load image "BILDER\Inventori.bmp",67
return
Constants:
#Constant bg 1
#Constant plyr 2
#Constant Image_plyr 3
#Constant Image_bg 4
return
Objects_Camera:
Load object "BILDER\Testobjekt.x", 1
Load object "BILDER\Flashlight.x", 453
`Stealthobject
rem make object box 31,15,60,15
`Quest/inventory
make object box 6,30,60,50
make object box 89,6,64,6
make object box 90,6,64,6
make object box 91,6,64,6
make object box 92,6,64,6
Load object "BILDER\newdraganddroptest.x",88
hide object 88
hide object 6
hide object 89
hide object 90
hide object 91
hide object 92
`helper object
make object sphere 2,1:color object 2,rgb(255,255,0)
`player object
load object "BILDER\Playertest.x",3
offset limb 3,0,0,2.5,0
make object cylinder 30,60
color object 30,rgb(0,0,255)
position camera 0,50,0
`Crates
Load object "BILDER\Testgjenstand.x",5
rotate object 5, 0,90,0
position object 5,1,0,35
Rem ***** Included Source File *****
MAIN_GAME_ENGINE:
`Flashlight
position light 1,object position X(3),0,object position Z(3)
position object 453,object position X(3),0,object position Z(3)
rotate object 453, object angle x(3), object angle y(3),0
`Stealth system
hide object 30
rem texture object 31,68
rem position object 31,40,y,40
rem position object 30,object position X(3),0,object position Z(3)
rem if object collision (30,5)
rem endif
`camera position before moving
x#=camera position x()
y#=camera position y()
z#=camera position z()
`moving camera 1000 units to get new x,y,z
move camera 1000
lx#=camera position x()
ly#=camera position y()
lz#=camera position z()
`getting camera back to actual posiiton
move camera -1000
`distance by intersect command with old coodinates and new coordinates
dis= intersect object(1,x#,y#,z#,lx#,ly#,lz#)
`camera movements
cam# = 90.001
cam2# = 10.1
if inkey$()="f"
fog off
cam# = cam2#
else if keystate(33)=0
fog on
endif
endif
control camera using arrowkeys 0,0.4,0.4
a#=wrapvalue(a#+mousemovex()/2)
rotate camera cam#,a#,0
`positioning object 2 in camera coords and rotating camera angle
position object 2,x#,y#,z#
rotate object 2,cam#,a#,0
move object 2,dis
`forcing player to point and folow helper object if we are into floor area
REM move object 3,0.01 ))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
if object collision(2,1) then point object 3,object position x(2),0,object position z(2)
hide object 2
`Object movement
if inkey$()="w" = 1 then move object 3,0.5
`Following camera
X2#=object position X(3)
Y2#=object position Y(3)
Z2#=object position Z(3)
AY#=object angle Y(3)
AX#=object angle X(3)
AZ#=object angle z(3)
`Rotate light
rotate light 1,AX#,AY#,AZ#
if cam# = cam2#
hide object 2
endif
position camera X2#,Y2#,Z2# `put the camera where the player is
if cam# <> cam2#
yrotate camera AY# `Yrotating the camera to the player's Y angle
endif
move camera -75 `move the camera back a bit
gosub Object_interaction
return
Rem ***** Included Source File *****
Object_interaction:
`Inventory
if keystate(23)=1
texture object 6,67
texture object 89,67
texture object 90,67
texture object 91,67
texture object 92,67
texture object 88,67
position object 6,x#,y,z#
position object 88,x#,70,z#-1.1
position object 89,x#-5,y,z#+10.5
position object 90,x#+5,y,z#+10.5
position object 91,x#-5,y,z#+3.5
position object 92,x#+5,y,z#+3.5
show object 6
show object 88
show object 89
show object 90
show object 91
show object 92
show mouse
set text size 60
center text 510,100,"INVENTORY"
set text size 40
for x = 390 to 482 : for y2 = 170 to 270
if mousex()=x and mousey()=y2 and Mouseclick()=1
hide object 89
endif
next x
next y2
for x = 540 to 630 : for y2 = 170 to 270
if mousex()=x and mousey()=y2 and Mouseclick()=1
hide object 90
endif
next x
next y2
for x = 390 to 482 : for y2 = 275 to 365
if mousex()=x and mousey()=y2 and Mouseclick()=1
hide object 91
endif
next x
next y2
for x = 540 to 630 : for y2 = 275 to 365
if mousex()=x and mousey()=y2 and Mouseclick()=1
hide object 92
endif
next x
next y2
rotate camera cam#,0,0
else if keystate(23)=0
hide object 6
hide object 88
hide object 89
hide object 90
hide object 91
hide object 92
hide mouse
endif
endif
`Quest/loot object
if object collision(3,5) and keystate(16)=1
position object 6,x#,y,z#
texture object 6,66
show object 6
show mouse
rotate camera cam#,0,0
else if object collision(3,5) and keystate(16)=0
hide object 6
hide mouse
endif
endif
return
Quote: "I'm fairly sure that set shadow shading on should be before the main game loop "
Quote: "Set Shadow Shading On should indeed not appear inside a loop"
Hmm... that could be the problem, but I think this will lead to a another problem, and that is how I could get the shadows to move with my player. I have used this syntax to get the shadows to appear along the side with my player, and I have no idea of how I could be able to make how the shadows follow my players movement outside the do/loop?
set shadow position 1, object position x(3),0, object position z(3)
Quote: "And you might have better result without using hardware shadows but instead use software shadows. For example on my pc shadows does not work at all in hardware mode.
"
I have heard about a software shader called the Evolved shader, but I dont know have I use it