UoB-COMSM0110 / 2024-group-3

0 stars 1 forks source link

Fix bug: game freezes (HIGH PRIORITY) #61

Open chriskerrc opened 3 months ago

chriskerrc commented 3 months ago

Error messages:

"Array index out of bounds" "Some characters not available in the current font, use createFont() to specify a typeface the includes them. ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 540"

chriskerrc commented 3 months ago

Image

chriskerrc commented 3 months ago

To make game freeze, shoot a lot of venom (hold down space bar) and travel towards left or top of the screen (i.e. towards x=0 or y=0). When the snake hits or almost hits the edge of the screen, the game should freeze. This doesn't happen when travelling towards the bottom or the right of the screen.

Example error message: ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 1200

In this case, there is no createFont error message. So this might be a separate but related bug?

chriskerrc commented 3 months ago

Disabled firing venom within 3 cells of left and top boundary: https://github.com/UoB-COMSM0110/2024-group-3/commit/1f69f1ee3043d38dae67a6f81153a6dbed8591b6

This seems to have stopped the freezing, but I'm keeping this ticket open in case the game still freezes.

This isn't an ideal fix, because it won't be clear to the user why they can't fire so close to the wall. Maybe we should add this to the Help page?

chriskerrc commented 3 months ago

I suspect the createFont() message has nothing to do with this bug. Probably comes from users hitting keys on the gameover screen?