Oh stupid site, there was more on this post
I'll try again:
This version is to large but works fine:
cls
hide mouse
sync on
sync rate 60
do
repeat
cls rgb(100,100,100)
ink rgb(255,255,255),1
print "choose level between 1 and 10"
input level#
until level# => 1 and level# =< 10
levelmaths#=level#*4-100
levelline#=(abs(levelmaths#))
ink rgb(000,255,000),2
box 0,0,15,levelline#
get image 1,0,0,15,levelline#
ink rgb(255,000,000),3
box 0,0,15,100
get image 2,0,0,15,100
ink rgb(255,255,255),4
box 0,0,15,15
get image 3,0,0,15,15
cls rgb(100,100,100)
score=0
playerx#=10.0
playery#=240.0
playerspeed#=0.0
playermove#=2.0
player=1
enemyx#=610.0
enemyy#=240.0
enemyspeed#=0.0
enemymove#=3.0
enemy=2
ballx#=100.0
bally#=200.0
ballxspeed#=2.0
ballyspeed#=2.0
ballinc#=0.2
ball=3
repeat
if upkey()=1
playerspeed#=0.0-playermove#
else
if downkey()=1
playerspeed#=playermove#
else:playerspeed#=0
endif
endif
if enemyy#+50-bally# < 0.0
enemyspeed#=enemymove#
endif
if enemyy#+50-bally# > 0.0
enemyspeed#=0.0-enemymove#
endif
if playery# < 0.0 then playery#=0.0
if playery# > 480.0-levelline# then playery#=480.0-levelline#
if enemyy# < 0.0 then enemyy#=0.0
if enemyy# > 380.0 then enemyy#=380.0
if bally# < 0.0 or bally# > 465.0 then ballyspeed# = 0.0-ballyspeed#
playery#=playery#+playerspeed#:enemyy#=enemyy#+enemyspeed#
ballx#=ballx#+ballxspeed#
bally#=bally#+ballyspeed#
sprite player,playerx#,playery#,player
sprite enemy,enemyx#,enemyy#,enemy
sprite ball,ballx#,bally#,ball
if sprite collision(player,ball)
ballxspeed#=0.0+(abs(ballxspeed#)+ballinc#)
random#=(rnd(10)-5)/10.0
ballyspeed#=ballyspeed# + (playerspeed/2) + random#
score=score+1
endif
if sprite collision(enemy,ball)
ballxspeed#=0.0-(abs(ballxspeed#)+ballinc#)
random#=(rnd(10)-5)/10.0:ballyspeed#=ballyspeed# + (enemyspeed/2) + random#
endif
sync
until ballx# > 640.0 or ballx# < -15.0
cls
print "score: ";score
repeat
sync
until returnkey() or spacekey()
if spacekey()=1 then exit
loop
This is a 19 line version, but the ball won't move to me and I can't move my racket:
cls:hide mouse:sync on:sync rate 60
do:repeat:cls rgb(100,100,100):ink rgb(255,255,255),1:print "choose level between 1 and 10"
input level#:until level# => 1 and level# =< 10:levelmaths#=level#*4-100:levelline#=(abs(levelmaths#)):ink rgb(000,255,000),2
box 0,0,15,levelline#:get image 1,0,0,15,levelline#:ink rgb(255,000,000),3:box 0,0,15,100:get image 2,0,0,15,100
ink rgb(255,255,255),4:box 0,0,15,15:get image 3,0,0,15,15:cls rgb(100,100,100):score=0
playerx#=10.0:playery#=240.0:playerspeed#=0.0:playermove#=2.0:player=1
enemyx#=610.0:enemyy#=240.0:enemyspeed#=0.0:enemymove#=3.0:enemy=2
ballx#=100.0:bally#=200.0:ballxspeed#=2.0:ballyspeed#=2.0:ballinc#=0.2
ball=3:repeat:if upkey()=1:playerspeed#=0.0-playermove#:else
if downkey()=1:playerspeed#=playermove#:else:playerspeed#=0:endif
endif:if enemyy#+50-bally# < 0.0:enemyspeed#=enemymove#:endif:if enemyy#+50-bally# > 0.0
enemyspeed#=0.0-enemymove#:endif:if playery# < 0.0 then playery#=0.0:if playery# > 480.0-levelline# then playery#=480.0-levelline#:if enemyy# < 0.0 then enemyy#=0.0
if enemyy# > 380.0 then enemyy#=380.0:if bally# < 0.0 or bally# > 465.0 then ballyspeed# = 0.0-ballyspeed#:playery#=playery#+playerspeed#:enemyy#=enemyy#+enemyspeed#:ballx#=ballx#+ballxspeed#
bally#=bally#+ballyspeed#:sprite player,playerx#,playery#,player:sprite enemy,enemyx#,enemyy#,enemy:sprite ball,ballx#,bally#,ball:if sprite collision(player,ball)
ballxspeed#=0.0+(abs(ballxspeed#)+ballinc#):random#=(rnd(10)-5)/10.0:ballyspeed#=ballyspeed# + (playerspeed/2) + random#:score=score+1:endif
if sprite collision(enemy,ball):ballxspeed#=0.0-(abs(ballxspeed#)+ballinc#):random#=(rnd(10)-5)/10.0:ballyspeed#=ballyspeed# + (enemyspeed/2) + random#
endif:sync:until ballx# > 640.0 or ballx# < -15.0:cls:print "score: ";score
repeat:sync:until returnkey() or spacekey():if spacekey()=1 then exit
loop
We're all Christ and we're all Hitler.We want Christ to win.What would he've done if he had advertisements, T.V. and newspapers?The miracle today is communication.So let's use it.-John Lennon '69