Ok for some reason this isn't working for me, i've looked all through that thread that batVink showed and alot fo them seemed to used luskos' suggestion... however, i just can't get it to work.
sync on
sync rate 80
set display mode 1600,900,32
autocam off
set image colorkey 0,0,0
color backdrop 0
global radius# as double float : radius# = 3.0
makelevel()
makeplayer()
`player movement vector
global vx# as double float
global vy# as double float
global vz# as double float
global gravity# as double float : gravity# = -0.1
global slope# as double float : slope# = 0.5
global ground as integer : ground = 1
`Start main loop
do
position mouse 800,450
moveplayer()
HandleCamera()
`Debug information
set cursor 0,0
print "x:";object position x(2)
print "y:";object position y(2)
print "z:";object position z(2)
print "angle :";object angle Y(2)
print "Fps :";screen fps()
print "Distance :";pck#
print ":- ";Entry$()
if object position x(2)=<-75 and object position x(2)=>-105 and object position z(2)=>-15 and object position z(2)=<15 and spacekey()=1
position object 2,Object position x(2)-10,object position y(2),object position z(2)
endif
if object position x(2)=<-52 and object position x(2)=>-62 and object position z(2)=<-380 and object position z(2)=>-397 and spacekey()=1
position object 2,object position x(2)+15,object position y(2),object position z(2)
endif
if object position x(2)=<-35 and object position x(2)=>-45 and object position z(2)=<-380 and object position z(2)=>-397 and spacekey()=1
position object 2,Object position x(2)-15,object position y(2),object position z(2)
endif
if object position z(2)=>255 then yrotate object 2,180
if pick object (mousex(),mousey(),300,300)>0 then color object 300,rgb(12,13,0) else texture object 300,1
if pick object (mousex(),mousey(),300,300)>0 and mouseclick()=1 then clear entry buffer : ComputerScreen()
pck#=get pick distance()
sync
loop
function makelevel()
load object "F:\Game Creation\Dark Basic pro\Projects\Eternal Waking\smallward.dbo",1
set object cull 1,0
sc_setupcomplexobject 1,1,2
sc_allowobjectscaling 1
scale object 1,25,25,25
load object "F:\Game Creation\Dark Basic pro\Projects\Eternal Waking\Hospitalhall.dbo",3
set object cull 3,0
sc_setupcomplexobject 3,1,2
sc_allowobjectscaling 3
scale object 3,25,25,25
load object "F:\Game Creation\Dark Basic pro\Projects\Eternal Waking\Keyboard.x",300
load image "F:\Game Creation\Dark Basic pro\Projects\Eternal Waking\black.png",1
scale object 300,25,25,25
set object cull 300,0
position object 300,0,0,0
ghost object on 300
endfunction
`FUNCTIONS
function makeplayer()
make object sphere 2,radius#*2.0
hide object 2
position object 2,70,9,50
yrotate object 2,180
sc_setupobject 2,0,1
endfunction
function moveplayer()
yrotate object 2,object angle y(2)+mousemovex()/3
xrotate object 2,object angle x(2)+mousemovey()/3
oldx# = object position x(2)
oldy# = object position y(2)
oldz# = object position z(2)
angy# = object angle y(2)
vx# = 0
vz# = 0
`if vy#=0 then vy# = vy# + 10*gravity# else vy# = vy# + gravity#
if keystate(32)=1 then vx# = vx# + cos(angy#) : vz# = vz# - sin(angy#)
if keystate(30)=1 then vx# = vx# - cos(angy#) : vz# = vz# + sin(angy#)
if keystate(31)=1 then vx# = vx# - sin(angy#) : vz# = vz# - cos(angy#)
if keystate(17)=1 then vx# = vx# + sin(angy#) : vz# = vz# + cos(angy#)
x#=oldx#+vx#
y#=oldy#+vy#
z#=oldz#+vz#
collide = sc_spherecastgroup(1,oldx#,oldy#,oldz#,oldx#,oldy#+vy#,oldz#,radius#,0)
if collide>0
ny# = sc_getCollisionNormalY()
if abs(ny#)>slope#
`Flat ground
oldy# = sc_getStaticCollisionY()
else
`Steep slope, cause to slide
x# = x# - oldx# : z# = z# - oldz#
oldx# = sc_getCollisionSlideX()
oldy# = sc_getCollisionSlideY()
oldz# = sc_getCollisionSlideZ()
x# = x# + oldx# : z# = z# + oldz#
endif
`ny#<0 means the player has hit a ceiling rather than a floor
if ny#>slope#
`only on ground if standing on flat ground
ground = 1
vy# = 0
else
ground = 0
`If player has hit a flat ceiling then stop vy# movement
if ny#<-slope# then vy# = gravity#
endif
else
`Nothing below player, not on ground, add vertical speed to player
oldy# = oldy# + vy#
ground = 0
endif
collide = sc_SphereSlideGroup(1,oldx#,oldy#,oldz#,x#,oldy#,z#,radius#,0)
if collide>0
`If hit, reposition player, stop movement
x# = sc_getCollisionSlideX()
oldy# = sc_getCollisionSlideY()
z# = sc_getCollisionSlideZ()
vx# = 0
vz# = 0
endif
position object 2,x#,oldy#,z#
sc_updateObject 2
sc_updateobject 1
sc_updateobject 3
endfunction
Function HandleCamera()
`Start the camera oriented with the player and then move it backwards
position camera 0,object position x(2),Object position y(2)+20,object position z(2)
rotate camera 0,object angle x(2)+30,object angle y(2),object angle z(2)
`move camera 0,-30
`We want the camera to slide along any face it hits, so we use SC_sphereSlideGroup to slide a sphere with a radius of 1
`from the player's position to the camera's position (we'll change the camera's position if there's a hit, of course).
Collision=SC_sphereSlideGroup(1,object position x(2),object position y(2),object position z(2),camera position x(0),camera position y(0),camera position z(0),1,0)
`If there was a collision, position the camera at the sliding collision point
if Collision
position camera 0,SC_getCollisionSlideX(),SC_getCollisionSlideY(),SC_getCollisionSlideZ()
point camera 0,Object position x(2),Object position y(2),object position z(2)
endif
endfunction
Function ComputerScreen()
load image "F:\Game Creation\Dark Basic pro\Projects\Eternal Waking\Screen.bmp",2
h# = (screen height() + 0.0) / screen width()
if object exist (301)=0
make object plain 301, 1.920, 2.120 * h#
lock object on 301
position object 301, 0.0, 0.0, 1.000001
texture object 301,2
endif
keyword$=entry$(1)
ink 0,1
text 800,450,":-"+Keyword$
if keyword$="typewriter"
cls
delete object 301
endif
endfunction
Now when i click the keyboard it brings up the plane that makes the "screen" but when i type, nothing shows up and even if i type the correct keyword nothing happens, i'm not sure why, i get the impression that it has something to do with the
if pick object (mousex(),mousey(),300,300)>0 and mouseclick()=1 line, as when i hold the mouse button down i can see the text prompt flickering on and off
Windows 7 64 bit, AMD Phenom II x4 Black edition, 4 GB Ram, Radeon HD 4650, 540 GB HDD
I can see from your smile, you're not here for the sunset.