First off, if you need to scale an object that is using Sparky's, you have to allow it, like this:
sc_setupObject player,1,1
sc_allowobjectscaling player
scale object player,400,400,400
It is always a good idea to check and see what Sparky's sees as the object boundaries when you first load in an object to ensure it is correct. I set up the player object to sphere collision and using SC_DRAWOBJECTBOUNDS, it showed the bounding box. Here is a pic:
After using SC_ALLOWOBJECTSCALING (code listed above), it looked like this:
Also, you really don't need a collision sphere when you set up an object like this, so I would suggest eliminating that playercollisionsphere object altogether.
Here is a working version (albeit not perfect) of the game. You were moving the player downward with the camera at the end of the playermove subroutine. Also, you needed to allow scaling on the terrain object.
Rem Project: Game in Progress
Rem Created: Thursday, November 17, 2011
Rem ***** Main Source File *****
Rem Project: Dark Basic Pro Project
Rem Created: Thursday, November 17, 2011
Rem ***** Main Source File *****
sync on : sync rate 60 : Autocam off : backdrop off : hide mouse
set window on : set display mode 1024,768,32 : set window position 100,100 : set ambient light 100
imagefront=100
imageback=101
imageleft=102
imageright=103
imageup=104
imagedown=105
skyfront=100
skyback=101
skyleft=102
skyright=103
skyup=104
skydown=105
skyboxplanesize=50000
player=1 `Player Object number
playercam=1 `camera object number
`playercollisionsphere=2 `Player's collision detection mesh
playerspeed#=0.5 `Speed Player moves backwards and forwards
turnspeed# = 2.0 `Speed Player turns left and right
playerx#=0 `Players Initial Starting X co-ordinate
playery#=300 `Players Initial Starting y co-ordinate
playerz#=145 `Players Initial Starting z co-ordinate
groundobject=3
groundtextureimage=1
playertexture=2
gravity#=0.5
radius# = 8.0
Height# = 450 `Initial Starting Height
cam_move#=0
sensitivity#=0.2
mouse_invert=0
REM ================ TERRAIN SETUP ===========================================
`Terrain created in T.ED and then exported as one large supertexture and a DirectX
`model. The props are also created in T.ED and exported as one large seperate
`DirectX model. Both DirectX models are merged into one using Ultimate
`Unwrap3D and finaly exported as one large DirectX 9 Model.
`remstart
load object "media\level.x" ,groundobject `| When activated this block
position object groundobject,-2000,0,-2000 `| work with the current
set object transparency groundobject,4 `| collison system. Any Ideas
sc_setupcomplexobject groundobject,1,2 `| why?
sc_allowobjectscaling groundobject
scale object groundobject,1000,1000,1000 `| of code does not seem to
SC_UpdateObject groundobject `|
`remend
remstart
MAKE OBJECT plane groundobject,10000,10000 `| When this Block of code is
xrotate object groundobject,90 `| activated instead of the above
load image "media\ground.jpg",groundtextureimage `| it seems to work fine with the
texture object groundobject,groundtextureimage `| current collision system.
SCALE OBJECT TEXTURE groundobject,16,16 `|
sc_setupcomplexobject groundobject,1,2 `|
SC_UpdateObject groundobject `|
remend
rem ================= Make Skybox ==========================================
LOAD IMAGE "media\siege_front.jpg",imagefront
LOAD IMAGE "media\siege_back.jpg",imageback
LOAD IMAGE "media\siege_left.jpg",imageleft
LOAD IMAGE "media\siege_right.jpg",imageright
LOAD IMAGE "media\siege_top.jpg",imageup
MAKE OBJECT PLANE skyfront,skyboxplanesize,skyboxplanesize
MAKE OBJECT PLANE skyback,skyboxplanesize,skyboxplanesize
MAKE OBJECT PLANE skyleft,skyboxplanesize,skyboxplanesize
MAKE OBJECT PLANE skyright,skyboxplanesize,skyboxplanesize
MAKE OBJECT PLANE skyup,skyboxplanesize,skyboxplanesize
TEXTURE OBJECT skyfront,imagefront
TEXTURE OBJECT skyback,imageback
TEXTURE OBJECT skyleft,imageleft
TEXTURE OBJECT skyright,imageright
TEXTURE OBJECT skyup,imageup
SET OBJECT TEXTURE skyfront,3,0
SET OBJECT TEXTURE skyback,3,0
SET OBJECT TEXTURE skyleft,3,0
SET OBJECT TEXTURE skyright,3,0
SET OBJECT TEXTURE skyup,3,0
ROTATE OBJECT skyfront,0,180,0
ROTATE OBJECT skyback,0,0,0
ROTATE OBJECT skyleft,0,90,0
ROTATE OBJECT skyright,0,270,0
ROTATE OBJECT skyup,90,180,0
POSITION OBJECT skyfront,x#,y#,z#+skyboxplanesize/2
POSITION OBJECT skyback,x#,y#,z#-skyboxplanesize/2
POSITION OBJECT skyleft,x#-skyboxplanesize/2,y#,z#
POSITION OBJECT skyright,x#+skyboxplanesize/2,y#,z#
POSITION OBJECT skyup,x#,y#+skyboxplanesize/2,z#
set camera range 1,100000
load object "media\werewolf.x",player `load an object to serve as a Player
load image "media\fur.jpg",playertexture `Load the objects Texture
`rotate object player,0,180,0
`fix object pivot player
texture object player,playertexture `Texture the Players Object with the loaded Texture
position object player,playerx#,playery#,playerz# `Position the PLayer in Initial start position
radius# = object size y(player) / 2
sc_setupObject player,1,1
sc_allowobjectscaling player
scale object player,400,400,400
`sc_drawobjectbounds player
`make object sphere playercollisionsphere,radius#
`position object playercollisionsphere,camera position x(),camera position y()+Height#,camera position z()
set object to camera orientation player
`sc_setupObject playercollisionsphere,0,1
rem SET OBJECT WIREFRAME playercollisionsphere,1
`hide object playercollisionsphere
DO
gosub playermove
gosub gameinfo
sync
LOOP
end
playermove:
OldXpos#=object position x(player)
OldYpos#=object position y(player)
OldZpos#=object position z(player)
gosub SimulatedGravity
if keystate(17) then move object player,playerspeed# `W key moves player forward
if keystate(31) then move object player,-playerspeed# `S key moves player backward
if keystate(30) : `If A is pressed rotate player left
y# = object angle y(player)
y# = wrapvalue(y# - turnspeed#)
yrotate object player,y#
endif
if keystate(32) : `If D is pressed rotate player right
y# = object angle y(player)
y# = wrapvalue(y# + turnspeed#)
yrotate object player,y#
endif
playerXpos#=object position x(player)
playerYpos#=object position y(player)
playerZpos#=object position z(player)
set camera to object orientation player `Update the Camera to Players facing angle
collide = SC_SphereSlide(groundobject,OldXpos#,OldYpos#,OldZpos#,playerXpos#,playerYpos#,playerZpos#,radius#,0)
if collide > 0
text 400,100, "Collision with Ground detected"
x#=SC_GetCollisionSlideX()
y#=SC_GetCollisionSlideY()
z#=SC_GetCollisionSlideZ()
position object player,x#,y#,z#
sc_updateobject player
else
position object player,playerXpos#,playerYpos#,playerZpos#
sc_updateobject player
endif
x#=object position x(player)
y#=object position y(player)
z#=object position z(player)
position camera x#,y#+12 ,z# : move camera -15.0
point camera x#,y#,z#
return
SimulatedGravity:
position object player,object position x(player),object position y(player)-gravity#,object position z(player)
sc_updateobject player
return
gameinfo: // Some Game variables printed on the screen to help the Progammer debug
set cursor 10,10
print "Scancode key being pressed = "+str$(scancode())
text 10,100, "Player Z Position " + str$(playerZpos#,1)
text 10,120,"Player y position " + str$(playerYpos#,1)
text 10,140,"Player x position " + str$(playerXpos#,1)
text 10,160,"Player's Y Angle:" + str$(object angle y(player))
text 10,10,"screen fps "+str$(screen fps() )
return
Hope this is helpful.