#80643 - biubid_boy - Mon Apr 24, 2006 1:27 pm
Hello everybody.
I'm working on a game, a bit like pog, but with four paddles (bars) instead of one. The idea is that if a ball colides with the green paddle, it changes to green, but if it colides with the green wall, it stays the same colour, namely yellow. I'm only working with two paddles as of now. For yellow it already works but I cant seem to do it for green. Heres my code:
Can anyone help me get this sorted?
Thanks,
Biubid_boy.
I'm working on a game, a bit like pog, but with four paddles (bars) instead of one. The idea is that if a ball colides with the green paddle, it changes to green, but if it colides with the green wall, it stays the same colour, namely yellow. I'm only working with two paddles as of now. For yellow it already works but I cant seem to do it for green. Heres my code:
Code: |
void MoveBall(void) { if (ballDirection == 0 && xball < xMax && yball < yMax) { xball++;xball++; yball++; } if (ballDirection == 0 && ((xball >= xMax || yball >= yMax) || (xball >= xpaddlegreen - 6 && yball >= ypaddlegreen && yball <= ypaddlegreen + 16))) { memcpy( (u16 *)0x06014000, &ballgreenData, sizeof(ballgreenData) ); if (xball >= xMax || xball >= xpaddlegreen - 6) { ballDirection = 3; } else { ballDirection = 1; } } if (ballDirection == 1 && xball < xMax && yball > yMin) { xball++;xball++; yball--; } if (ballDirection == 1 && ((xball >= xMax || yball <= yMin) || (xball >= xpaddlegreen - 6 && yball >= ypaddlegreen && yball <= ypaddlegreen + 16))) { if (xball >= xMax || xball >= xpaddlegreen - 6) { ballDirection = 2; } else { ballDirection = 0; } } if (ballDirection == 2 && xball > xMin && yball > yMin) { xball--;xball--; yball--; } if (ballDirection == 2 && ((xball <= xMin || yball <= yMin) || (xball == xpaddleyellow + 8 && yball >= ypaddleyellow && yball <= ypaddleyellow + 32))) { if (xball == xpaddleyellow + 8) { memcpy( (u16 *)0x06014000, &ballyellowData, sizeof(ballyellowData) ); ballDirection = 1; } else if (xball <= xMin) { ballDirection = 1; } else { ballDirection = 3; } } if (ballDirection == 3 && xball > xMin && yball < yMax) { xball--;xball--; yball++; } if (ballDirection == 3 && ((xball <= xMin || yball >= yMax) || (xball == xpaddleyellow + 8 && yball >= ypaddleyellow && yball <= ypaddleyellow + 32))) { if (xball == xpaddleyellow + 8) { memcpy( (u16 *)0x06014000, &ballyellowData, sizeof(ballyellowData) ); ballDirection = 0; } else if (xball <= xMin) { ballDirection = 0; } else { ballDirection = 2; } } } |
Can anyone help me get this sorted?
Thanks,
Biubid_boy.