- bool collision_x(int n) {\r
- if (x + n < 0 || x + n >= WIDTH)\r
- return true;\r
- for (int i = 0; i != n; i += (n < 0 ? -1 : 1))\r
- if (get_block(x_screen + i + (n < 0 ? -1 : 1), y_screen) == 'X')\r
- return true;\r
- return false;\r
- }\r
- bool collision_y(int n) {\r
- if (y + n < 0 || y + n >= HEIGHT)\r
+ bool collision(int xdir, int ydir) {\r
+ int newx = x + xdir;\r
+ int newy = y + ydir;\r
+ if (newx < 0 || newx >= WIDTH || newy < 0 || newy >= HEIGHT)\r