TGC Codebase Backup



3D 3rd person walking goblin by Caleb1994

9th Sep 2008 23:46
Summary

im new to this and this is my first program woo lol all the files are in the media that came with dark basic



Description



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    rem make matrix
make matrix 1,10000.0,10000.0,25,25
load bitmap "stone1.bmp",1
get image 1,0,0,128,128
delete bitmap 1
prepare matrix texture 1,1,2,2
randomize matrix 1,50.0
set matrix height 1,12,12,300.0
update matrix 1

rem load goblin
load object "idle.x",1 : append object "walk.x",1,100
yrotate object 1,180 : FIX object pivot 1

LOOP OBJECT 1,0,20 : SET OBJECT SPEED 1,10

x#=500
y#=500


sync on : hide mouse

do


stage=0
if upkey()=1 then x#=newxvalue(x#,a#,10) : z#=newzvalue(z#,a#,10) : stage=1
if downkey()=1 then x#=newxvalue(x#,a#,-10) : z#=newzvalue(z#,a#,-10) : stage=1
if leftkey()=1 then a#=wrapvalue(a#-10.0)
if rightkey()=1 then a#=wrapvalue(a#+10.0)


IF stage<>oldstage
   IF stage=0
      SET OBJECT FRAME 1,0.0
      LOOP OBJECT 1,0,20
      SET OBJECT SPEED 1,10
   ENDIF
   IF stage=1
      SET OBJECT FRAME 1,105.0
      LOOP OBJECT 1,105,125
      SET OBJECT SPEED 1,40
   ENDIF
   oldstage=stage
ENDIF


y#=get ground height(1,x#,z#)+50.0
position object 1,x#,y#,z#
yrotate object 1,a#


cx#=newxvalue(x#,wrapvalue(a#+180),300)
cz#=newzvalue(z#,wrapvalue(a#+180),300)
cy#=get ground height(1,cx#,cz#)+100.0
position camera cx#,cy#,cz#


point camera x#,y#,z#

sync

loop