CodeBase - racing game(no media included)
Return to the CodeBase listing
Category: Games
Version: 1.0
Information
Uploaded: 27th Dec 2003 07:22
Modified: 1st Jan 1970 01:00
Author: Alastair Zotos
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!
Full Description
`-----------<br /> `Racing game<br /> `-----------<br /> Sync on<br /> Sync rate 1000<br /> set camera range 1,9999999<br /> hide mouse<br /> set ambient light 50<br /> <br /> `start<br /> cls 0<br /> sleep 1000<br /> center text 320,240,"Get Ready!"<br /> sleep 1000<br /> cls 0<br /> center text 320,240,"3"<br /> sleep 1000<br /> cls 0<br /> center text 320,240,"2"<br /> sleep 1000.<br /> cls 0<br /> center text 320,240,"1"<br /> sleep 1000<br /> cls 0<br /> center text 320,240,"GO!"<br /> sleep 500<br /> backdrop on<br /> color backdrop rgb(0,255,255)<br /> <br /> `make a car<br /> make object cube 1,50<br /> make object cube 2,50<br /> scale object 2,100,50,200<br /> for c=1 to 2<br /> color object c,rgb(0,0,255)<br /> next c<br /> make object cylinder 3,100<br /> zrotate object 3,90<br /> fix object pivot 3<br /> scale object 3,51,15,15<br /> color object 3,0<br /> make object cylinder 4,100<br /> zrotate object 4,90<br /> fix object pivot 4<br /> scale object 4,51,15,15<br /> color object 4,0<br /> <br /> `make an opponent<br /> make object cube 5,50 <br /> make object cube 6,50<br /> scale object 6,100,50,200<br /> for o=5 to 6<br /> color object o,0<br /> next o<br /> <br /> `make a matrix texture<br /> cls rgb(0,255,0)<br /> ink rgb(128,128,128),1<br /> box 0,0,10,256<br /> box 0,0,256,10<br /> ink rgb(255,255,255),1<br /> box 245,0,250,10<br /> get image 1,0,0,256,256<br /> <br /> `make a matrix<br /> make matrix 1,20000,20000,1,1<br /> prepare matrix texture 1,1,1,1<br /> <br /> `prepare for main loop<br /> x#=200<br /> z#=0<br /> ox#=100<br /> oz#=0<br /> timer=1<br /> <br /> `main loop<br /> do<br /> <br /> `control player<br /> if upkey()=1<br /> x#=newxvalue(x#,a#,25)<br /> z#=newzvalue(z#,a#,25)<br /> endif<br /> if leftkey()=1<br /> a#=wrapvalue(a#-2.5)<br /> endif<br /> if rightkey()=1<br /> a#=wrapvalue(a#+2.5)<br /> endif<br /> <br /> `update player(u must use this for the player to move)<br /> y#=get ground height(1,x#,z#)<br /> position object 1,x#,y#+25,z#<br /> position object 2,x#,y#+12.5,z#<br /> yrotate object 1,a#<br /> yrotate object 2,a#<br /> wheela#=wrapvalue(curveangle(a#,wheela#,2.0))<br /> wheelx#=newxvalue(x#,wrapvalue(wheela#+180),30)<br /> wheelz#=newzvalue(z#,wrapvalue(wheela#+180),30)<br /> wheely#=get ground height(1,wheelx#,wheelz#)+2.5<br /> position object 3,wheelx#,wheely#,wheelz#<br /> yrotate object 3,wheela#<br /> wheelb#=wrapvalue(curveangle(a#,wheelb#,1.0))<br /> wheelxx#=newxvalue(x#,wrapvalue(wheelb#+0),30)<br /> wheelzz#=newzvalue(z#,wrapvalue(wheelb#+0),30)<br /> wheelyy#=get ground height(1,wheelxx#,wheelzz#)+2.5<br /> position object 4,wheelxx#,wheelyy#,wheelzz#<br /> yrotate object 4,wheelb#<br /> <br /> `update camera so it smoothly follows the player<br /> ca#=wrapvalue(curveangle(a#,ca#,12.0))<br /> cx#=newxvalue(x#,wrapvalue(ca#+180),300)<br /> cz#=newzvalue(z#,wrapvalue(ca#+180),300)<br /> cy#=get ground height(1,cx#,cz#)+100.0<br /> position camera cx#,cy#,cz#<br /> yrotate camera wrapvalue(ca#)<br /> <br /> `make sure player stayes on matrix<br /> if x#<0 then x#=0<br /> if x#>20000 then x#=20000<br /> if z#<0 then z#=0<br /> if z#>20000 then z#=20000<br /> <br /> `move opponent<br /> if oz#<19400<br /> oa#=0<br /> else<br /> oa#=90<br /> endif<br /> <br /> `make sure opponent stayes on matrix<br /> `(for this u only have to do a oz# value because the AI wont let the <br /> `opponent out of the matrix anyway)<br /> if oz#>20000 then oz#=20000<br /> ox#=newxvalue(ox#,oa#,24)<br /> oz#=newzvalue(oz#,oa#,24)<br /> <br /> `position opponent<br /> position object 5,ox#,40,oz#<br /> yrotate object 5,oa#<br /> position object 6,ox#,25,oz#<br /> yrotate object 6,oa#<br /> <br /> `win the race<br /> if x#>19500 and z#>19284 and ox#<19500<br /> cls 0<br /> inc timer<br /> if timer>0<br /> cls 0<br /> center text 320,240,"You won!"<br /> x#=19500<br /> endif<br /> if timer>1000 then end<br /> endif<br /> <br /> `lose the race<br /> if ox#>19500 and oz#>19284 and x#<19500<br /> cls 0<br /> inc timer<br /> if timer>0<br /> cls 0<br /> center text 320,240,"You lost!"<br /> ox#=19500<br /> endif<br /> if timer>1000 then end<br /> endif<br /> <br /> <br /> `end loop<br /> sync<br /> loop
Comments
No comments yet.