Added 'clean' to makefile to make removing binaries before commits easier and fixed logic error in breakout.c
This commit is contained in:
parent
841efab5eb
commit
d274b674e5
@ -377,7 +377,7 @@ void updateBall(Uint32 tickrate, ball *theBall, paddle *thePaddle, int winWidth,
|
|||||||
if (colliding) {
|
if (colliding) {
|
||||||
if (theBall->isColliding == 0) {
|
if (theBall->isColliding == 0) {
|
||||||
|
|
||||||
theBall->isColliding == 1; // This keeps track of any current attepmts to 'solve' collision
|
theBall->isColliding = 1; // This keeps track of any current attepmts to 'solve' collision
|
||||||
// Without this flag, if the ball ends up within another object and moving slow enough that on the next frame it has not escaped the object,
|
// Without this flag, if the ball ends up within another object and moving slow enough that on the next frame it has not escaped the object,
|
||||||
// it will repeatedly have its velocity multiplied by -1 and get stuck, effectively moving only along one axis. With this flag,
|
// it will repeatedly have its velocity multiplied by -1 and get stuck, effectively moving only along one axis. With this flag,
|
||||||
// the game will ignore subsequent collisions, until it is no longer colliding. Note this does not solve the same problem where two objects
|
// the game will ignore subsequent collisions, until it is no longer colliding. Note this does not solve the same problem where two objects
|
||||||
@ -646,4 +646,4 @@ void initialiseBricks(brick *bricks, int *brickCount) {
|
|||||||
bricks[110] = (brick) { .brickType = 4, .x = 401, .y = 214, .width = 30, .height = 10, .destroyed = 0 };
|
bricks[110] = (brick) { .brickType = 4, .x = 401, .y = 214, .width = 30, .height = 10, .destroyed = 0 };
|
||||||
bricks[111] = (brick) { .brickType = 4, .x = 433, .y = 214, .width = 30, .height = 10, .destroyed = 0 };
|
bricks[111] = (brick) { .brickType = 4, .x = 433, .y = 214, .width = 30, .height = 10, .destroyed = 0 };
|
||||||
*brickCount = 112;
|
*brickCount = 112;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,3 +3,6 @@ breakout_c = breakout
|
|||||||
all: breakout.c
|
all: breakout.c
|
||||||
clang $(breakout_s) -l SDL2 -lGLU -lGL -lm -o $(breakout_c)
|
clang $(breakout_s) -l SDL2 -lGLU -lGL -lm -o $(breakout_c)
|
||||||
./breakout
|
./breakout
|
||||||
|
|
||||||
|
clean: breakout.c
|
||||||
|
rm $(breakout_c)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user