This can become a 1K hires (or normal to play with ZXMORE

Code: Select all
char directionX, directionY;
unsigned char x, y;
unsigned char lastX, lastY;
unsigned char angleX;
unsigned char ballDirection;
/**
* Resets level variables
*
* @author sbebbington
* @date 07 Jan 2018
* @version 1.0
*/
void resetLevel()
{
x = 2 + (random % 4);
y = 2;
directionX = 1;
directionY = 1;
gameCounter = 0;
}
/**
* Moves the ball around the play area
*
* @author Shaun B
* @date 06 Jab 2018
* @version 1.0
*/
void moveBall()
{
lastX = x;
lastY = y;
if((angleX % 2) == 0)
{
x += directionX;
if(x < 2 || x > 29)
{
directionX = -directionX;
}
}
y += directionY;
if(y < 2 || y > 20)
{
directionY = -directionY;
}
if(x != lastX || y != lastY)
{
setText(clear, lastX, lastY, 0);
}
setText(ball, x, y, 0);
angleX += ballDirection;
}