This is a game that I have somewhat made. I have taken some things I have found in the code base and some of the stuff that came with my copy of DBPRO. The problem I am having right now is that I can not move my person/object the way I want. He will turn left and right but only goes up or down not foreword or backward. Any advice or suggests are welcome aswell but try and help me with the movement first. Thanks. If this doesnt work please let me know and I will post this without code thing. This is my first post like this.
rem Initialise
sync on : sync rate 60 : hide mouse
set display mode 800,600,32
load image "rockwall_01.jpg",5
rem Global data
dim objtype(10000)
global ambience# as integer
global blockobj as integer
rem make matrix
gosub _make_matrix
rem make hero
gosub _make_hero
rem make enemies (not completed)
gosub _make_enemies
rem make land
gosub _make_land
rem make weapon (not completed)
gosub _make_weapon
rem start demo
gosub _start_demo
rem Main Loop
do
rem control hero
gosub _control_hero
rem make camera follow hero
gosub _control_weapon
rem enemies
gosub _control_enemies
rem music
gosub _control_music
rem Stats
center text screen width()/2,440,user$
Rem sync
sync
rem end and loop
loop
end
_control_hero:
rem store hero position before actoin
oox1#=object position x(1)-40
ooy1#=object position y(1)
ooz1#=object position z(1)-40
oox2#=object position x(1)+40
ooy2#=object position y(1)+190
ooz2#=object position z(1)+40
rem Move hero
walk=0
scrape=0
if grabseq=0
if upkey() then move object 1,2 : walk=1
if downkey() then move object 1,-2 : walk=1
if leftkey() then yrotate object 1,wrapvalue(object angle y(1)-4): walk=1
if rightkey() then yrotate object 1,wrapvalue(object angle y(1)+4): walk=1
if controlkey()=1 and grab=0 and pushslider>0 then grab=1 : grabseq=1 : change=0
else
if grabseq>=2 and grabseq<=3 and upkey()=1 and pushslider>0
if object position z(pushslider)<1800
if pushdire=1 then move object 1,4 : move object pushslider,4 : scrape=1
endif
if object position x(pushslider)>200
if pushdire=2 then move object 1,4 : yrotate object pushslider,270 : move object pushslider,4
endif
endif
endif
rem position player
rem Track hero with camera
x#=object position x(1)
y#=object position y(1)
z#=object position z(1)
a#=object angle y(1)
d#=30
h#=30
s#=15
set camera to follow x#,y#,z#,a#,d#,h#,s#,1
rem Animate hero for walking
if grab=0
if walk<>lastwalk then change=1
if change=1
if walk=0 then loop object 1,0*heroframe#,39*heroframe#
if walk=1 then loop object 1,40*heroframe#,59*heroframe#
change=0 : lastwalk=walk
endif
else
if change=0
if grabseq=1 then play object 1,60*heroframe#,80*heroframe#
if grabseq=2 then play object 1,120*heroframe#,150*heroframe#
if grabseq=3 then loop object 1,130*heroframe#,149*heroframe#
if grabseq=4 then play object 1,80*heroframe#,100*heroframe#
if grabseq=5 then play object 1,60*heroframe#,80*heroframe#
if grabseq=6 then play object 1,160*heroframe#,190*heroframe#
if grabseq=7 then loop object 1,170*heroframe#,189*heroframe#
change=1
endif
endif
return
_control_weapon:
return
_control_enemies:
return
_control_music:
return
_make_matrix:
rem Matrix
make matrix 1000,1024.0,1024.0,10,10
`randomize matrix 1000,10
prepare matrix texture 1000,5,1,1
rem get matrix ground height for player to walk on
ground#=get ground height(1000,posx#,posz#)+10
return
_make_hero:
rem make hero
`Load object "C:\Program Files\Dark Basic Software\Dark Basic Professional\Media\Models\Colonel Z\ColZ_Run.X",1
`load object "C:\Program Files\Dark Basic Software\Dark Basic Professional\Media\Models\Colonel Z\ColZ.3DS",1
`load image "C:\Program Files\Dark Basic Software\Dark Basic Professional\Media\Models\Colonel Z\Col_Z.jpg",43
load object "C:\Program Files\Dark Basic Software\Dark Basic Professional\Media\Models\Colonel Z\ColZ.X",1
load image "C:\Program Files\Dark Basic Software\Dark Basic Professional\Media\Models\Colonel Z\Col_Z.TGA",43
scale object 1,20,20,20
make object collision box 1,-40,0,-40,40,150,40,0
set object specular 1,0
fix object pivot 1
`xrotate object 1,90
set object speed 1,1200
rotate object 1,270,270,0
rem heros position before game
`Rotate object 1,270,270,0
rem postion player
`position player
posx#=500.0
posz#=500.0
`yrotate object 1,90
return
_make_enemies:
rem still has lots of work
return
_make_land:
rem color backdrop
color backdrop Rgb(0,0,255)
rem load walls
load object "brick_wall_X_02.x",2
scale object 2,100,200,100
make object collision box 2,-32,-20,-20,32,20,20,0
position object 2,32,0,0
show object 2
rem create brick wall along matric perimeter
for l=10 to 40
instance object l,2
scale object l,100,200,100
make object collision box l,-20,-20,-20,20,20,20,0
position object l,(32*(l-8)),0,0
show object l
next l
for l=10 to 41
instance object l+41,2
scale object l+41,100,200,100
make object collision box l+41,-20,-20,-20,20,20,20,0
position object l+41,(32*(l-9)),0,1024
show object l+41
rem a wall
instance object l+73,2
scale object l+73,100,200,100
make object collision box l+73,-32,-20,-20,32,20,20,0
rotate object l+73,0,90,0
position object l+73,-16,0,(32*(l-10))
show object l+73
rem a wall
instance object l+115,2
scale object l+115,100,200,100
make object collision box l+115,-32,-20,-20,32,20,20,0
rotate object l+115,0,90,0
position object l+115,1024,0,(32*(l-10))
show object l+115
next l
return
_make_weapon:
rem make weapon (figure out what limb to put it on)
`load object "C:\Program Files\Dark Basic Software\Dark Basic Professional\Projects\asdfkjas;df\sword_01.x",33
`glue object to limb 33,1,12
`scale object 33,17,15,15
`LIMB CHECK
`if inkey$()="L" or inkey$()="l"
` perform checklist for object limbs 1
` for c=1 to checklist quantity()
`print (c)
`print checklist string$(c)
`next c
`inkey$()="?"
`endif
return
_start_demo:
rem begin hero stuff ( hopefully makes animation)
position object 1,550,0,550
position camera 400,15,400
heroframe#=total object frames(1)/200
loop object 1,0,39*heroframe#
return