i was watching a kid a school playing this game... and i liked it! so i set my mind on coding a copy... not exactly the same... but its ok!
hope you enjoy.
oh yea... I Think I Have Figured Out What Is Wrong With The Collision Code On My Helicopter Game... Shall Inspect More Later - Must Have Dinner!!! haha. coding this game's collision made me think...
'Modern Pong
'Coded by Sir Johnah
'17.10.06
open window 640,512
input "ENTER TO CONTINUE"default
?
? "NO SPACES"
input "Enter Name: "name$
if name$="" name$="DBF"
variables()
sub variables()
r=250
g=250
b=250
pux=35
puy=256
bax=400
bay=256
diry=int(ran(2))
score=0
hi_=1000
b_hi=0
if play=0 play()
if play=1 game()
end sub
sub play()
label play
setdrawbuf db
db=1-db
setdispbuf db
clear window
draw()
setrgb 1,250,250,250
clear fill rect 100,100,540,412
rect 102,102,538,410
text 115,120,"Modern Pong"
text 115,140,"Coded by Sir Johnah"
line 115,148,525,148
text 115,170,"Control you puk up and down using the"
text 115,190,"Up and Down Keys whilst trying to hit"
text 115,210,"the ball."
text 115,230,"You get points for returning the ball."
text 115,250,"Hit the green section... you get +100"
text 115,270,"Points. Hit the red section... you get"
text 115,290,"+200 Points. Hit the blue section..."
text 115,310,"and you get +500 Points!"
text 115,330,"Don't let the ball past - or you will"
text 115,350,"die!"
text 115,370,"Enjoy the game... and Hello to everyone"
text 115,390,"at the DBF Forums. Cheers."
text 115,395," >_<"
text 263,433,"Hit X to Play"
if peek("port1")=16384 game()
goto play
end sub
sub game()
label loop
setdrawbuf db
db=1-db
setdispbuf db
clear window
controls()
chk()
draw()
goto loop
end sub
sub controls()
j=peek("port1")
if and(j,16)<>0 puy=puy-10
if and(j,64)<>0 puy=puy+10
end sub
sub chk()
'GET SCORE
if (bax>639 and bay<140) then:score=score+100:hit=1:fi
if (bax>639 and bay>=140 and bay<226) then:score=score+200:hit=2:fi
if (bax>639 and bay>=226 and bay<=286) then:score=score+500:hit=3:fi
if (bax>639 and bay>286 and bay<=372) then:score=score+200:hit=2:fi
if (bax>639 and bay>372 and bay<447) then:score=score+100:hit=1:fi
'CHK PIK
if puy<=95 puy=95
if puy>=407 puy=407
'CHK BALL
if bay<=65 diry=1-diry
if bay>437 diry=1-diry
if diry=0 bay=bay-5
if diry=1 bay=bay+5
'HIT BALL
if (bay+8<=puy+40 and bay-8>=puy-40 and bax<=pux+10) dir=1-dir
if bax>=640 dir=1-dir
if dir=0 bax=bax-5
if dir=1 bax=bax+5
if bax<=30 then:r=200:g=0:b=0:fi
if bax<=0 die()
'CALC HIGH BEAT
if score>hi_ then:hi_=score:b_hi=1:fi
end sub
sub die()
play=1
label die
setdrawbuf db
db=1-db
setdispbuf db
clear window
draw()
setrgb 1,250,250,250
clear fill rect 100,100,540,412
rect 102,102,538,410
text 115,120,"Bummer... You Have Died!!!"
if b_hi=1 then
text 115,160,"But you managed to beat the high score!"
text 115,180,"CONGRADULATIONS!!!"
text 115,185," >_<"
fi
text 115,220,"Play Again... Good Luck!"
text 115,300,"Cheers,"
text 115,320," Sir Johnah"
text 263,433,"Hit X to Play"
if peek("port1")=16384 variables()
goto die
end sub
sub draw()
'DRAW BOARD
setrgb 1,180,190,200
setrgb 2,0,0,0
setrgb 3,0,0,0
gtriangle 0,0 to 0,60 to 640,60
setrgb 3,180,190,200
gtriangle 0,512 to 0,452 to 640,512
setrgb 2,180,190,200
setrgb 3,0,0,0
gtriangle 0,0 to 640,0 to 640,60
setrgb 2,0,0,0
gtriangle 640,512 to 640,452 to 0,452
setrgb 1,0,0,0
text 20,495,name$+"'S SCORE: "+str$(score)
text 440,495,"HI SCORE: "+str$(hi_)
setrgb 1,0,0,150
fill rect 0,226,640,286
fill triangle 0,55 to 0,226 to 640,226
fill triangle 0,286 to 0,447 to 640,286
setrgb 1,150,0,0
fill triangle 400,162 to 640,140 to 640,226
fill triangle 400,346 to 640,372 to 640,286
setrgb 1,0,150,0
fill triangle 0,55 to 400,162 to 640,55
fill triangle 400,162 to 640,55 to 640,140
fill triangle 0,447 to 400,346 to 640,447
fill triangle 400,346 to 640,372 to 640,447
'DRAW PLAYER
setrgb 1,250,250,250
clear fill rect pux-8,puy-40,pux+8,puy+40
fill rect pux-6,puy-38,pux+6,puy+38
'DRAW BALL
setrgb 1,r,g,b
clear fill circle bax,bay,8
fill circle bax,bay,6
'GET HIT VISUAL
if hit=1 then
st$="100"
timer=30
time_on=1
sx=600
sy=bay
hit=0
fi
if hit=2 then
st$="200"
timer=30
time_on=1
sx=600
sy=bay
hit=0
fi
if hit=3 then
st$="500"
timer=30
time_on=1
sx=600
sy=bay
hit=0
fi
if time_on=1 then
sc=sc+10
setrgb 1,250-sc,250-sc,250-sc
sy=sy-0.5
text sx,sy,st$
timer=timer-1
if timer<=0 time_on=0
elsif time_on=0 then
st$=""
hit=0
sc=0
fi
end sub