Hi there. I have been trying to make a 2D motobike race retro style for android and decided to make it first in Dbpro. Long since I programmed games in 2D . I suppose that the track can be done in a data but I prefer to make a random track so the track appears and the player have to try to be on road. The game is goin to be something like old sega games like this video:
http://www.youtube.com/watch?v=TU2hm8ylv9w&feature=related
This is what I have so far.
autocam off
sync on
set display mode 800,600,32
set window on
set window layout 1,1,0
set camera range 1,30000
set camera fov 130
hide mouse
`some textures
load image "camino.bmp",1
load image "desert.bmp",2
load image "piedra.bmp",3
load image "fondo3.bmp",4
load image "moto.bmp",5
load image "moto2.bmp",6
load music "motorbike.mp3",1
load music "ritmo.mid",2
loop music 1
loop music 2
for i= 1 to 14
make object box i,70,0,5.1
position object i,0,0,i*5
texture object i,1
next i
for i= 1 to 14 step 2
yrotate object i,180
fix object pivot i
next i
`landscape
make object box 15,1000,0,140:position object 15,0,-0.1,-0.5:texture object 15,2
scale object texture 15,10,2
`mountain
make object box 16,2200,200,0:texture object 16,4:position object 16,0,55,200
set object emissive 16,rgb(255,255,255)
position camera 0,15,20
point camera 0,0,50
`this object will create the bends on the road
make object box 100,2,2,2:hide object 100
`stone
make object box 17,40,40,0:texture object 17,3:set object 17,1,1,1,1
set object transparency 17,2
set object emissive 17,rgb(255,255,255)
`player
make object plain 18,10,15:texture object 18,5
yrotate object 18,180:fix object pivot 18:set object 18,1,1,0,0
`enemy
make object plain 19,10,15:texture object 19,6
yrotate object 19,180:fix object pivot 19:set object 19,1,1,0,0
position object 19,0,7,0
clone object 20,19
do
set cursor 5,15
ink rgb(255,0,0),0
print "YOU ARE IN POSITION ",1+p
move object 19,0.01
if object position z(19)>70 then position object 19,0,7,-100 :p=p+1 `if the scooter disappear in front it will position far back
`when the enemy is back, it will position in center of the road
if object position z(19)<0 then position object 19,camera position x(),7,object position z(19)
`forcing the enemy to be into the road
for i= 1 to 14
if object collision(19,i)
position object 19,object position x(i),7,object position z(19)
endif
next i
`enemy 2
for i= 1 to 14
if object collision(20,i)
position object 20,object position x(i),7,object position z(20)
endif
next i
scroll object texture 15,0,-0.005
move object 17,-0.3
if object position z(17)<-500
if rnd(2)=1 then position object 17,object position x(1)-50-rnd(30),0,90
if rnd(2)=2 then position object 17,object position x(1)+50+rnd(30),0,90
endif
`object that create the bends
run=run+1 `cron to position all parts of the road
if run>1300
giro=45+rnd(90)
if rnd(100)=1 then yrotate object 100,giro
move object 100,0.4
pz#=object position z(100)
position object 100,0,0,pz#
if smoo#<pz# then inc smoo#,0.2
if smoo#>pz# then dec smoo#,0.2
if object position z(100)<-280 then position object 100,0,0,-280
if object position z(100)>280 then position object 100,0,0,280
endif
for i= 1 to 14
dec escalado
xx=object position x(i)
move object i,-0.3
if object position z(i)<0 then position object i,smoo#/2,0,70
scale object i,100-object position z(i)/2,100,100
x=object position x(i)
if x>xx then mon#=0.0001
if x<xx then mon#=-0.0001
next i
scroll object texture 16,mon#,0
`camera movements (player)
if leftkey() then pos#=pos#-0.1:zrotate object 18,5
if rightkey() then pos#=pos#+0.1:zrotate object 18,-5
if scancode()=0 then zrotate object 18,0
if pos#<-350 then pos#=-350 `limits of the landscape
if pos#>350 then pos#=350
position camera pos#,15,20
point camera pos#,0,50
position object 18,camera position x(),camera position y()-7,camera position z()
move object 18,15
`enemy 2
position object 20,object position x(20),7,camera position z()
move object 20,40
sync
loop
Is there an easy way to make the track ?
Cheers.
I'm not a grumpy grandpa
