TGC Codebase Backup



Simple Game concept by Nenohum

20th Sep 2006 21:32
Summary

Just a niffty game to help get started on a maze type game.



Description

Just a simple game concept. No vairable to control when game ends but it is hard to find the goal at all(small cube). Just load your own textures on



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    ` This code was downloaded from The Game Creators
` It is reproduced here with full permission
` http://www.thegamecreators.com

`intial setup
Sync on
Sync rate 30
hide mouse
backdrop on
fog on
set camera range 1,6000
fog distance 1000
fog color RGB(128,128,128)
color backdrop RGB(128,128,128)

`make player
make object sphere 200,50
set object collision to spheres 200
position object 200,rnd(10000),0,rnd(10000)

`make obstacles
For x = 1 to 100
   make object cube x,100
   position object x,rnd(10000),0,rnd(10000)
Next x

`make goal
make object cube 201,25
position object 201,rnd(10000),0,rnd(10000)
set object collision to boxes 201

`make matrix
make matrix 1,10000,10000,20,20
`main loop
Do
      `print stuff
      set cursor 0,0
      Print "Get the cool cube"
      set cursor 0,10
      Print "Score: ",Score

      `store variables
      aY# = object angle Y(200)

      `controls
      If upkey()=1 then move object 200,20
      if leftkey()=1 then yrotate object 200,wrapvalue(aY#-5)
      if rightkey()=1 then yrotate object 200,wrapvalue(aY#+5)
      if downkey()=1 then move object 200,-10

      `get player positions
      X# = object position x(200)
      Z# = object position z(200)

      `get camera values
      cZ# = newzvalue(Z#,aY#-180,100)
      cX# = newxvalue(X#,aY#-180,100)

      `position camera
      position camera cX#,100,CZ#
      point camera X#,50,Z#

      `collision data
      if object collision(201,200)>0
      inc score
      position object 201,rnd(10000),0,rnd(10000)
      endif
      Sync

Loop