|
PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
|
23 const int Height = 26;
26 const int VCenter = 27;
27 const int HCenter = 63;
28 const int PadRow = 59;
30 const int PadStep = 2;
34 int Paddle[2] = {0,0};
37 int BallX = 0, BallY = 0;
38 int BallDx = 2, BallDy = 1;
108 if( (Paddle[0] + PadStep) < Height )
109 Paddle[0] += PadStep;
119 if( (Paddle[0] - PadStep) > -Height )
120 Paddle[0] -= PadStep;
131 if( (Paddle[1] + PadStep) < Height )
132 Paddle[1] += PadStep;
142 if( (Paddle[1] - PadStep) > -Height )
143 Paddle[1] -= PadStep;
159 if( BallY < Paddle[0] )
160 Paddle[0] -= PadStep;
161 if( BallY > Paddle[0] )
162 Paddle[0] += PadStep;
166 if( BallY < Paddle[1] )
167 Paddle[1] -= PadStep;
168 if( BallY > Paddle[1] )
169 Paddle[1] += PadStep;
175 if( BallX > -PadRow && (BallX+BallDx) <= -PadRow )
177 if( BallY >= (Paddle[0]-PadLen) &&
178 BallY <= (Paddle[0]+PadLen) &&
179 (BallY+BallDy) >= (Paddle[0]-PadLen) &&
180 (BallY+BallDy) <= (Paddle[0]+PadLen) )
188 if( BallX < PadRow && (BallX+BallDx) >= PadRow )
190 if( BallY >= (Paddle[1]-PadLen) &&
191 BallY <= (Paddle[1]+PadLen) &&
192 (BallY+BallDy) >= (Paddle[1]-PadLen) &&
193 (BallY+BallDy) <= (Paddle[1]+PadLen) )
200 if( BallY <= -Height )
204 else if( BallY >= Height )
229 else if( BallX < -Width )
255 letter(
'0' + Score[0] );
258 letter(
'0' + Score[1] );
260 box(0, 1, Width*2, Height*2+1, 1);
261 point(BallX + HCenter, BallY + VCenter, 1);
262 line( HCenter-PadRow, VCenter + Paddle[0] - PadLen, HCenter-PadRow, VCenter + Paddle[0] + PadLen, 1 );
263 line( HCenter+PadRow, VCenter + Paddle[1] - PadLen, HCenter+PadRow, VCenter + Paddle[1] + PadLen, 1 );
272 Score[0] = Score[1] = 0;
273 Paddle[0] = Paddle[1] = 0;
#define OFF
OFF can be used in place of zero to enabled parameters in functions like drive_feedback and drive_tri...