racing game(no media included) by Alastair Zotos27th Dec 2003 7:22
|
---|
Summary This is a cool racing game that u will like because im only 13 and its the best racing game i made, I have made better games b4 tho! Description `----------- Code ` This code was downloaded from The Game Creators ` It is reproduced here with full permission ` http://www.thegamecreators.com `----------- `Racing game `----------- Sync on Sync rate 1000 set camera range 1,9999999 hide mouse set ambient light 50 `start cls 0 sleep 1000 center text 320,240,"Get Ready!" sleep 1000 cls 0 center text 320,240,"3" sleep 1000 cls 0 center text 320,240,"2" sleep 1000. cls 0 center text 320,240,"1" sleep 1000 cls 0 center text 320,240,"GO!" sleep 500 backdrop on color backdrop rgb(0,255,255) `make a car make object cube 1,50 make object cube 2,50 scale object 2,100,50,200 for c=1 to 2 color object c,rgb(0,0,255) next c make object cylinder 3,100 zrotate object 3,90 fix object pivot 3 scale object 3,51,15,15 color object 3,0 make object cylinder 4,100 zrotate object 4,90 fix object pivot 4 scale object 4,51,15,15 color object 4,0 `make an opponent make object cube 5,50 make object cube 6,50 scale object 6,100,50,200 for o=5 to 6 color object o,0 next o `make a matrix texture cls rgb(0,255,0) ink rgb(128,128,128),1 box 0,0,10,256 box 0,0,256,10 ink rgb(255,255,255),1 box 245,0,250,10 get image 1,0,0,256,256 `make a matrix make matrix 1,20000,20000,1,1 prepare matrix texture 1,1,1,1 `prepare for main loop x#=200 z#=0 ox#=100 oz#=0 timer=1 `main loop do `control player if upkey()=1 x#=newxvalue(x#,a#,25) z#=newzvalue(z#,a#,25) endif if leftkey()=1 a#=wrapvalue(a#-2.5) endif if rightkey()=1 a#=wrapvalue(a#+2.5) endif `update player(u must use this for the player to move) y#=get ground height(1,x#,z#) position object 1,x#,y#+25,z# position object 2,x#,y#+12.5,z# yrotate object 1,a# yrotate object 2,a# wheela#=wrapvalue(curveangle(a#,wheela#,2.0)) wheelx#=newxvalue(x#,wrapvalue(wheela#+180),30) wheelz#=newzvalue(z#,wrapvalue(wheela#+180),30) wheely#=get ground height(1,wheelx#,wheelz#)+2.5 position object 3,wheelx#,wheely#,wheelz# yrotate object 3,wheela# wheelb#=wrapvalue(curveangle(a#,wheelb#,1.0)) wheelxx#=newxvalue(x#,wrapvalue(wheelb#+0),30) wheelzz#=newzvalue(z#,wrapvalue(wheelb#+0),30) wheelyy#=get ground height(1,wheelxx#,wheelzz#)+2.5 position object 4,wheelxx#,wheelyy#,wheelzz# yrotate object 4,wheelb# `update camera so it smoothly follows the player ca#=wrapvalue(curveangle(a#,ca#,12.0)) cx#=newxvalue(x#,wrapvalue(ca#+180),300) cz#=newzvalue(z#,wrapvalue(ca#+180),300) cy#=get ground height(1,cx#,cz#)+100.0 position camera cx#,cy#,cz# yrotate camera wrapvalue(ca#) `make sure player stayes on matrix if x#<0 then x#=0 if x#>20000 then x#=20000 if z#<0 then z#=0 if z#>20000 then z#=20000 `move opponent if oz#<19400 oa#=0 else oa#=90 endif `make sure opponent stayes on matrix `(for this u only have to do a oz# value because the AI wont let the `opponent out of the matrix anyway) if oz#>20000 then oz#=20000 ox#=newxvalue(ox#,oa#,24) oz#=newzvalue(oz#,oa#,24) `position opponent position object 5,ox#,40,oz# yrotate object 5,oa# position object 6,ox#,25,oz# yrotate object 6,oa# `win the race if x#>19500 and z#>19284 and ox#<19500 cls 0 inc timer if timer>0 cls 0 center text 320,240,"You won!" x#=19500 endif if timer>1000 then end endif `lose the race if ox#>19500 and oz#>19284 and x#<19500 cls 0 inc timer if timer>0 cls 0 center text 320,240,"You lost!" ox#=19500 endif if timer>1000 then end endif `end loop sync loop |