-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPong.bpp
155 lines (114 loc) · 2.44 KB
/
Pong.bpp
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
///,ball=81
///,null=32
///,lpad=118
///,rpad=117
///,lpadx=2
///,rpadx=37
///,rxbounce=36
///,lxbounce=3
///,scr=1024
///,sy=25
///,winpoints=5
///,bg1=53280
///,bg2=53281
///,txt=646
///,black=0
///,white=1
///,blue=6
///,lblue=14
///{cls
print chr$(147)
}///
rem set up the screen colors
poke ///bg1///,///white///
poke ///bg2///,///black///
poke ///txt///,///white///
rem clear the screen
///cls///
rem points
pl%=0
pr%=0
rem l is left r is right
ly%=11
ry%=12
rem ball position
bx%=20
by%=12
rem speed multipliers
xm%=1
ym%=1
rem updating the ball position
///.inputmanager
if peek(56321)=255 then goto p2check
if peek(1026)=///lpad/// then goto p1d
if peek(56321)=254 then ly%=ly%-1:goto p2check
///.p1d
if peek(1986)=///lpad/// then goto p2check
if peek(56321)=253 then ly%=ly%+1
///.p2check
if peek(56320)=127 then goto posupdater
if peek(1061)=///rpad/// then goto p2d
if peek(56320)=126 then ry%=ry%-1:goto posupdater
///.p2d
if peek(2021)=///rpad/// then goto posupdater
if peek(56320)=125 then ry%=ry%+1
///.posupdater
if by%=0 or by%=24 then ym%=-ym%
if peek(///scr///+bx%+xm%+((by%+ym%)*40))<>///null/// then xm%=-xm%
bx%=bx%+xm%
by%=by%+ym%
///.render
poke ///scr///+(bx%-xm%)+((by%-ym%)*40),///null///
poke ///scr///+bx%+(by%*40),///ball///
if bx%=0 then pr%=pr%+1:goto wl
if bx%=39 then pl%=pl%+1:goto wr
rem poking the pads
ls%=///scr///+///lpadx///+(ly%*40)
rs%=///scr///+///rpadx///+(ry%*40)
poke ls%,///lpad///
poke ls%+40,///lpad///
poke ls%+80,///lpad///
poke ls%-40,///lpad///
poke ls%-80,///lpad///
poke rs%,///rpad///
poke rs%+40,///rpad///
poke rs%+80,///rpad///
poke rs%-40,///rpad///
poke rs%-80,///rpad///
rem clearing the sides
poke rs%-120,///null///
poke rs%+120,///null///
poke ls%-120,///null///
poke ls%+120,///null///
poke 1197,48+pl%
poke 1210,48+pr%
goto inputmanager
///.wl
xm%=-1
goto resetball
///.wr
xm%=1
goto resetball
///.resetball
poke ///scr///+bx%+(by%*40),///null///
if pl%=///winpoints/// then goto lwin
if pr%=///winpoints/// then goto rwin
bx%=20
by%=rnd(1)*24
ym%=1
goto inputmanager
///.lwin
///cls///
print "left player wins"
goto end
///.rwin
///cls///
print "right player wins"
goto end
///.end
rem reset the screen colors
poke ///bg1///,///lblue///
poke ///bg2///,///blue///
poke ///txt///,///lblue///
print " "
print "made by ago061 10/06/2022"