`-----------
`RACERS
`-----------
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)
rem load car
load object "f1body.x",1 : rem jeep body .
scale object 1,5,5,5
yrotate object 1,180:fix object pivot 1
load object "xwheel1.x",2 : rem front left wheel of jeep .
load object "xwheel1.x",3 : rem front right wheel of jeep .
load object "xwheel1.x",4 : rem rear right wheel of jeep .
load object "xwheel1.x",5 : rem rear left wheel of jeep .
rem load car
load object "f1body.x",6 : rem jeep body .
scale object 6,5,5,5
yrotate object 6,180:fix object pivot 6
load object "xwheel1.x",7 : rem front left wheel of jeep .
load object "xwheel1.x",8 : rem front right wheel of jeep .
load object "xwheel1.x",9 : rem rear right wheel of jeep .
load object "xwheel1.x",10 : rem rear left wheel of jeep .
`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
I guess it should be something like this...
Immunity and Annihalation makes Immunihalation...