I made a few improvements to your game, added levelups that speed the ball up, slowed the paddle down (it was hard to control) and removed the media (if you intend to use a program as an example then you should remove the media first anyway)
Edit: forgot to include the code!
Sync rate 40
hide mouse
rem set up variables
points#=0
lives#=3
rem make paddle
Make object box 10,3,0.5,1:color object 10,rgb(0,0,0)
rem make ball
make object sphere 11,1
position object 11,0,0,0
color object 11,rgb(255,255,0)
balla#=150
rem make blocks
blockx=-12:blockz=6
for t = 21 to 35
blockx=blockx+4
if blockx=12 then blockx=-8:blockz=blockz-2
make object box t,3,0.5,1: color object t,rgb(255,0,0)
position object t,blockx,0,blockz
next t
rem board
make object box 36,0.5,2,18.5
position object 36,-11.7,0,0
make object box 37,0.5,2,18.5
position object 37,11.7,0,0
make object box 38,24,2,0.5
position object 38,0,0,9.5
for t=36 to 38
color object t,rgb(0,255,0)
next t
make object box 39,24.2,1,23
position object 39,0,-1,0
color object 39,rgb(230,230,230)
make object box 40,80,1,80
position object 40,0,-2,0
color object 40,rgb(185,185,185)
for t=41 to 42
make object box t,1,80,80
next t
make object box 43,80,80,1
position object 41,-40,-2,0
position object 42,40,-2,0
position object 43,0,-2,40
for t=42 to 43
color object t,rgb(150,150,150)
next t
rem object positions
dim boxarray(35,1)
for t=21 to 35
boxarray(t,0)=object position x(t)
boxarray(t,1)=object position z(t)
next t
rem camera stuff
position camera 0,20,-20
point camera 0,0,0
Difficulty#=0.3
Level#=1
rem main loop
sync on
start:
do
position camera 0,20,-20
point camera 0,0,0
Set cursor 230,10
print "Level = ";Level#
rem ball movement
Ballx#=newxvalue(ballx#,balla#,difficulty#)
Ballz#=newzvalue(ballz#,balla#,difficulty#)
rem paddle controls
IF rightkey()=1 and player1pos#<10 then player1pos#=player1pos#+0.75
IF leftkey()=1 and player1pos#>-10 then player1pos#=player1pos#-0.75
IF rightkey()=1 and Ballx#>9 and ballx#<9.5 then balla#=Balla#+8
If leftkey()=1 and ballx#>9 and Ballx#<9.5 then balla#=Balla#-8
rem if it hits the walls
if ballx#<-11 and ballx#>-11.5 then balla#=360-balla#
if ballx#>11 and Ballx#<11.5 then balla#=360-balla#
If Ballz#>9 then balla#=180-balla#
rem if it hits the paddle
If ballz#<-9 and ballz#>-9.5 and ballx#>player1pos#-1 and ballx#<player1pos#+1
balla#=180-balla#
endif
If ballz#<-9 and ballz#>-9.5 and ballx#>player1pos#-1.5 and ballx#<player1pos#-1
balla#=230-balla#
endif
If ballz#<-9 and ballz#>-9.5 and ballx#>player1pos#+1 and ballx#<player1pos#+1.5
balla#=130-balla#
endif
balla#=wrapvalue(balla#)
position object 10,player1pos#,0,-10
position object 11,ballx#,0,ballz#
yrotate object 11,balla#
rem if it goes off the screen
if ballz#<-11
lives#=lives#-1
balla#=150
wait 1000
position object 11,0,0,0
Ballx#=0
Ballz#=0
endif
rem box collision
for t=21 to 35
if object exist(t)
if Sqrt((boxarray(t,0) - ballx#)^2 + (boxarray(t,1) - ballZ#)^2) <2
balla#=180-balla#
delete object t
points# = points#+10
endif
endif
next t
rem if you get rid of all the blocks
if points# = 150
set text size 50
set text font "verdana"
for t=1 to 20000
next t
points# = 0
difficulty#=difficulty# + 0.05
goto Levelup
endif
rem score/lives values
set text font "verdana"
set text size 15
set cursor 10,10
print "points = ";points#
set cursor 570,10
print "lives = ";lives#
rem if you run out of lives
if lives#<0
set text size 50
set text font "times new roman"
for t=1 to 20000
center text 320,240,"Game Over"
next t
end
endif
sync
loop
Levelup:
rem make blocks
blockx=-12:blockz=6
for t = 21 to 35
blockx=blockx+4
if blockx=12 then blockx=-8:blockz=blockz-2
make object box t,3,0.5,1: color object t,rgb(255,0,0)
position object t,blockx,0,blockz
next t
position object 11,0,0,0
Ballx#=0
Ballz#=0
lives#=lives#+1
Level#=Level#+1
goto start
if level# = 10
set text size 50
set text font "times new roman"
for t=1 to 20000
center text 320,240,"you win!"
next t
end
endif
I use darkbasic classic and i practically have no experience.