File: ping.kbs

package info (click to toggle)
basic256 0.9.6.69a-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 26,304 kB
  • sloc: cpp: 7,778; yacc: 926; lex: 575; sh: 21; makefile: 7
file content (63 lines) | stat: -rw-r--r-- 1,035 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
print "Use the J and K keys to move the paddle" 

fastgraphics

x = 30 
y = 280 
ballx = 30 
bally = 0 
ballxinc = 5 
ballyinc = 5 
xinc = 5 
speed = .04	## make speed smaller to play faster

loop1: 
a = key 
if a = 75 then x = x + 30 
if a = 74 then x = x - 30 
if x < 0 then x = 0 
if x > 200 then x = 200 
gosub drawpaddle 
gosub moveball 
gosub drawball 

refresh
goto loop1 

drawpaddle: 
color gray 
rect 0,0,300,300 
color darkblue 
rect x,y,100,10 
color blue 
rect x+1,y+1,98,8 
return 

moveball: 
ballx = ballx + ballxinc 
bally = bally + ballyinc 
if bally > 270 then gosub checkball 
if bally < 5 then ballyinc = -ballyinc 
if ballx > 295 then ballxinc = -ballxinc 
if ballx < 5 then ballxinc = -ballxinc 
pause speed
return 

checkball: 
if ballx < x - 3 then goto missed 
if ballx > (x + 103) then goto missed 
ballyinc = -ballyinc 
ballxinc = ((ballx - x) - 50) / 10 
return 

missed: 
print "You Missed!!" 
bally = 10 
return 

drawball: 
color black 
circle ballx, bally, 5
color white
circle ballx, bally, 4
return