TGC Codebase Backup



Some Game by Leon112

14th Oct 2007 13:28
Summary

My First Game . You need to destroy red cube by placing "mines"



Description

My First Game . You need to destroy red cube by placing "mines"



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    set display mode 800,600,16
set window size 800,600
set window title "Some game(By noob)"
sync on : sync rate 30

Set text font "Comic Sans Ms"
Set text size 28

make object cube 1,50
position object 1,400,0,400
color object 1,RGB(0,255,0)

make object cube 2,50
position object 2,700,0,700
color object 2,RGB(255,0,0)

make object plain 3,1000,1000
xrotate object 3,90
position object 3,500,-40,500

make object sphere 4,20
color object 4,RGB(255,128,0)
position object 4,-1000,0,-1000
hide object 4

make object sphere 5,50
position object 5,-200,0,-200
color object 5,RGB(0,128,255)
hide object 5

position camera 500,600,-150
xrotate camera 50

roundstart=0
starttime=500
gameover=0
lives=3
enehealth=200
sometext$="Game Over,Press any key to exit."
speed=6

do

if object collision(1,2)>0 then gameover=1
if object collision(2,4)>0
gosub position_bomb_and_dec_health
endif

if gameover=1 then gosub position_player_and_enemy_and_other_stuff
if lives<=0
lives=0
text 250,400,sometext$
sync
wait key
end
endif
if gameover=2
text 150,400,"You Win! Congratulations! *Press Any key To Exit*"
sync
wait key
end
endif
if enehealth=0 then gameover=2

if lives>3 then lives=3
pX#=object position x(1)
pZ#=object position z(1)

inc roundstart,10

if roundstart>starttime
`=====1=====
if upkey()=1
pX#=newxvalue(pX#,a#,speed)
pZ#=newzvalue(pZ#,a#,speed)
endif
if downkey()=1
pX#=newxvalue(pX#,a#,speed*-1)
pZ#=newzvalue(pZ#,a#,speed*-1)
endif
if leftkey()=1 then a#=a#-2.0
if rightkey()=1 then a#=a#+2.0
if controlkey()=1
OldpX#=pX#
OldpZ#=pZ#
position object 4,OldpX#,0,OldpZ#
show object 4
endif
`=====1-end=====
endif

`Enemy
if roundstart>starttime
point object  2,pX#,0,pZ#
move object 2,4
endif

yrotate object 1,a#
position object 1,pX#,0,pZ#

if roundstart<starttime then text 300,400,"Ready , Steady , Go!"
box 30,70,enehealth+30,100
text 20,10,"Lives: "+str$(lives)
text 20,30,"Press <Control> to place bombs."
ink RGB(255,0,0),0
text 70,70,"Enemy Health"
ink RGB(255,255,255),0

sync
loop
end

position_player_and_enemy_and_other_stuff:
position object 1,400,0,400
position object 2,700,0,700
hide object 4
position object 4,-100,0,-100
roundstart=0
starttime=500
gameover=0
dec lives
return

position_bomb_and_dec_health:
position object 4,-1000,0,-1000
hide object 4
dec enehealth,10
return