Skip to content

Commit 7a5182d

Browse files
Cleanup pingpong.c
1 parent 792b25b commit 7a5182d

File tree

1 file changed

+1
-15
lines changed

1 file changed

+1
-15
lines changed

src/usr/local/src/pingpong.c

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -86,20 +86,6 @@ void game_init() {
8686
reset_ball();
8787
}
8888

89-
static void collision(float zm_border, float zm_prevx, float *zm_newx, float *zm_xspeed, float rigid_x) {
90-
// assumes: zm is a square object
91-
// collison is written along x-coordinates but can be generalized.
92-
if(zm_prevx<=rigid_x-zm_border<=*zm_newx) {
93-
// move object as per collision for object moving from left to right.
94-
*zm_newx = 2*(rigid_x-zm_border) - (*zm_newx);
95-
*zm_xspeed = -1;
96-
} else if(zm_prevx>=rigid_x+zm_border>=*zm_newx) {
97-
// move object as per collision for object moving from right to left.
98-
*zm_newx = 2*(rigid_x+zm_border) - (*zm_newx);
99-
*zm_xspeed = -1;
100-
}
101-
}
102-
10389
void check_collision() {
10490
// wall
10591

@@ -241,4 +227,4 @@ int main(int argc,char *argv[]) {
241227
game();
242228
closegraph();
243229
return 0;
244-
}
230+
}

0 commit comments

Comments
 (0)