TGC Codebase Backup



Walls and Entity by Brandon Goss

24th Feb 2009 2:19
Summary

Tangible walls and stone giant attacking.



Description

This program will create 3 Tangible walls and also place an entity nearby. When you use the arrow keys to move towards the entity, the entity will swing at you. When you back away the entity will stop swinging. (Use your own filenames for the bitmap drawings.)



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    Rem Project: Attacking Stone Giant and a small Maze
Rem Created: 2/16/2009 7:14:36 AM

Rem ***** Main Source File *****
REM This program has a tangible 3 wall maze, and around the side of the maze
REM is a stone giant. Upon getting close to the stone giant with arrow keys
REM you'll see the stone giant attack. THen you can back away and the giant
REM will stop attacking.
Hide mouse
REM Lighting the background
Set Ambient light 80
color backdrop RGB(0,0,0)

REM Establish the two extra camera views, ( Back view and left side view )
Make camera 1
Set camera view 1,10,10,130,130
Position camera 1,-100,150,800
Point camera 1,0,0,0

Make camera 2
Set camera view 2,480,10,600,130
position camera 2,-500,150,500
point camera 2,110,0,350

REM Make first wall
Make object box 12,300,300,10
load image "C:\Documents and Settings\Owner\My Documents\My Pictures\Wall 1.bmp",4
Texture object 12,4
position object 12,0,100,-150
set object collision to polygons 12

REM Make second wall
Make object box 13,300,300,10
load image "C:\Documents and Settings\Owner\My Documents\My Pictures\Wall 2.bmp",5
Texture object 13,5
position object 13,0,100,150
yrotate object 13,180
Set object collision to polygons 13

REM MAKE third ROUTE CAVE DOOR
make object box 14,300,300,10
load image "C:\Documents and Settings\Owner\My Documents\My Pictures\Cave Door 1.bmp",6
Texture object 14,6
position object 14,150,100,0
yrotate object 14,270

Repeat
   Automatic camera collision 0,25,1
   Control camera using arrowkeys 0,1,1


REM Adding components of the stone giant
`Use your own pictures of a boulder rock and add a belly button to it.
`This will be the belly of the stone giant. Input the file location after load image.
`IN THIS PROGRAM YOU WILL BE USING ONLY ONE OF THE FOUR DIFFERENT TYPES OF IMAGES

Make object sphere 1,52,15,15
load image "C:\Documents and Settings\Owner\My Documents\My Pictures\Belly Button Marble.bmp",1
Texture object 1,1
Scale object 1,440,360,300
Position Object 1,-80,0,500

   `Inner and upper chest filling of the stone giant using only plain rock or stone picture.
Make object sphere 2,30,15,15
load image "C:\Documents and Settings\Owner\My Documents\My Pictures\Marble 1.bmp",2
Texture object 2,2
Scale object 2,465,475,352
Position Object 2,-80,70,500
`Neck of the stone giant. Use the same stone picture as of the chest filling picture.
Make object sphere 3,15,10,10
load image "C:\Documents and Settings\Owner\My Documents\My Pictures\Marble 1.bmp",2
Texture object 3,2
Scale object 3,475,450,350
Position object 3,-80,160,500

REM The head of the stone giant.
`Take an image of a boulder and add a face to it for use in this part.
Make object sphere 4,23,10,6
load image "C:\Documents and Settings\Owner\My Documents\My Pictures\einstein_hollow_face.bmp",3
texture object 4,3
scale object 4,475,550,350
position object 4,-80,210,490

REM The Left Chest muscle of the stone giant
` Use a boulder picture with a nipple on it.
make object sphere 5,30,15,15
load image "C:\Documents and Settings\Owner\My Documents\My Pictures\Belly Button Marble.bmp",1
Texture object 5,1
scale object 5,375,400,350
position object 5,-110,70,495
Xrotate object 5, 40
Zrotate object 5, 365
Yrotate object 5, 20

REM This is the right nipple of the stone giant
` You could use a boulder picture with a nipple on this one as well. The same picture
` as of what you've used on the left chest muscle.
Make object sphere 6,30,15,15
load image "C:\Documents and Settings\Owner\My Documents\My Pictures\Belly Button Marble.bmp",1
Texture object 6,1
scale object 6,375,400,350
position object 6,-50,70,495
Xrotate object 6,30
Zrotate object 6,15
Yrotate object 6,-20

REM THIS WILL BE THE BOULDER SHOULDER. Use regular boulder picture with nothing else on it.
`Using only the same picture as of the inner chest picture.
Make object sphere 7,150,10,10
load image "C:\Documents and Settings\Owner\My Documents\My Pictures\Marble 1.bmp",2
texture object 7,2
position object 7,-75,100,510
scale object 7,155,75,75
xrotate object 7,-80

REM THIS WILL BE THE BOULDER'S RIGHT ARM BICEP. Use Regular boulder picture with
`nothing else on it. The same picture as of the inner chest picture.
make object sphere 8,150,20,10
load image "C:\Documents and Settings\Owner\My Documents\My Pictures\Marble 1.bmp",2
texture object 8,2
position object 8,15,85,505
scale object 8,45,100,50
Zrotate object 8,45


REM RIGHT ARM FORCEP using the boulder picture with nothing else drawn on it. The same
`picture as of the inner chest picture.
make object sphere 9,150,10,10
load image "C:\Documents and Settings\Owner\My Documents\My Pictures\Marble 1.bmp",2
texture object 9,2
position object 9,45,10,500
scale object 9,30,80,30


Rem left arm bicep. Remember to use only the same boulder picture as of the inner
`chest picture.
make object sphere 10,150,20,10
load image "C:\Documents and Settings\Owner\My Documents\My Pictures\Marble 1.bmp",2
texture object 10,2
position object 10,-165,85,505
scale object 10, 45,100,50
zrotate object 10,45
Xrotate object 10,90
Yrotate object 10,45

REM Left arm forcep. Remember to only use the same boulder picture as of the inner
`Chest picture.
Make object sphere 11,150,20,10
load image "C:\Documents and Settings\Owner\My Documents\My Pictures\Marble 1.bmp",2
texture object 11,2
position object 11,-180,10,460
scale object 11,30,80,30
zrotate object 11,28


`activating arrow movements
   REM AND WHEN THE PLAYER GETS CLOSE TO THE STONE GIANT THEN it will GO INTO THE LOOP BELOW.
Repeat
   Control Camera using arrowkeys 0,1,1
   While camera position z()>150
`Right arm bicep of stone giant lifted up to attack.
Repeat
   position object 8,15,105,480
   Zrotate object 8,45
   Xrotate object 8,80
   Yrotate object 8,0
`Right forcep is lifted as well
   position object 9,35,100,390
   Zrotate object 9,45
   Xrotate object 9,90
   Yrotate object 9,0

`Give the attack only 1/2 second and then return to the down position.
   Sleep 600; control camera using arrowkeys 0,1,1
   `right bicep brought back down.
   texture object 8,2
   position object 8,15,80,505
   scale object 8,45,100,50
   rotate object 8,-30,75,02
   `Right forcep brought back down.
   texture object 9,2
   position object 9,40,40,500
   scale object 9,30,80,30
   rotate object 9,0,90,05
   sleep 500
   control camera using arrowkeys 0,1,1
`Ending the loop.
Until camera position z()<151

`Maintaining control of the arrow movements.
control camera using arrowkeys 0,1,1
endwhile
until escapekey()=1
Show mouse
until escapekey()=1
END