Features:
Add Spin To The Ball!
Com Can Make Mistakes!(well this works fine on my computer)
Very Effective Motion Blur!
and much more!
Note:Requires Sparky 2.0
Note2:Sorry About the speed bug. well this is my first project I made in dbpro and when i tested it it was fine. (mabie because my computer is quite slow(pentium 4 H/T))
And Here It Is (Dark Basic Pro)
REM Project: Pong
REM Created: 30/08/2007 10:45:28
REM
REM ***** Main Source File *****
REM
REM -------------------LEVEL1--------------------------------------------------------------
rem startup
sync on : sync rate 30
hide mouse
make memblock 1,20
make camera 1
color backdrop 1,rgb(0,0,255)
position camera 1,0,500,0
xrotate camera 1,90
start:
rem make ball
make object sphere 1,20
rem make sides
make object box 2,350,100,20
position object 2,0,0,-100
make object box 3,350,100,20
position object 3,0,0,100
rem make players
make object box 4,10,40,40
position object 4,-175,0,0
make object box 5,10,40,40
position object 5,175,0,0
rem make ball move
rotate object 1,0,rnd(30)+30,0
bspeed#=15
gosub setupcollisions
gosub blur_setup
do
gosub printtext
gosub playerupdate
gosub moveball
gosub blur_loop
gosub aiupdate
gosub updatecollisions
sync
loop
moveball:
move object 1,bspeed#
if object position x(1)>200
ascore=ascore+1
goto reset
endif
if object position x(1)<-200
bscore=bscore+1
goto reset
endif
return
updatecollisions:
sc_updateobject 1
sc_updateobject 2
sc_updateobject 3
sc_updateobject 4
sc_updateobject 5
if sc_objectcollision(1,4)
i#=object angle y(1)
r#=i#-(i#*2)
ps#=mousemovey()*30
rotate object 1,0,r#+ps#,0
endif
if sc_objectcollision(1,5)
i#=object angle y(1)
r#=i#-(i#*2)
rotate object 1,0,r#,0
endif
if sc_objectcollision(1,2)
i#=object angle y(1)
r#=i#-(i#*2)
rotate object 1,0,r#+180,0
endif
if sc_objectcollision(1,3)
i#=object angle y(1)
r#=i#-(i#*2)
rotate object 1,0,r#+180,0
endif
return
setupcollisions:
sc_setupobject 1,0,2
sc_setupobject 2,0,2
sc_setupobject 3,0,2
sc_setupobject 4,0,2
sc_setupobject 5,0,2
sc_setobjectcollisionon 1
sc_setobjectcollisionon 4
sc_setobjectcollisionon 5
return
aiupdate:
rotate object 1,0,wrapvalue(object angle y(1)),0
oz#=z#
if object angle y(1)>0 and object angle y(1)<180 and object position x(1)>0
oz#=az#
bz#=object position z(1)+rd#
cz#=object position z(5)
spd#=0.1
if bz#>cz#
az#=az#+5
else
az#=az#-5
endif
position object 5,175,0,az#
else
rd#=(rnd(40)-20)
endif
if az#>70 then az#=70
if az#<-70 then az#=-70
return
playerupdate:
pz#=pz#-mousemovey()/2
if pz#>70 then pz#=70
if pz#<-70 then pz#=-70
position object 4,px#-175,0,pz#
return
reset:
delete object 1
delete object 2
delete object 3
delete object 4
delete object 5
gosub blur_end
goto start
return
printtext:
gamespeed#=screen fps()
gamespeed$=str$(gamespeed#)
text 0,0,gamespeed$
ascore$=str$(ascore)
bscore$=str$(bscore)
text 200,10,ascore$
text 400,10,bscore$
return
endprt:
return
blur_setup:
make object sphere 6,19
set alpha mapping on 6,80
make object sphere 7,17
set alpha mapping on 7,66
make object sphere 8,15
set alpha mapping on 8,33
return
blur_loop:
position object 6,object position x(1),object position y(1),object position z(1)
rotate object 6,0,object angle y(1),0
move object 6,-5
position object 7,object position x(1),object position y(1),object position z(1)
rotate object 7,0,object angle y(1),0
move object 7,-10
position object 8,object position x(1),object position y(1),object position z(1)
rotate object 8,0,object angle y(1),0
move object 8,-15
return
blur_end:
delete object 6
delete object 7
delete object 8
return