dev-jjjjjeong-bin / Invaders-SDP

3 stars 15 forks source link

[BUG] (Level Design Team) Stage Freeze After Enemy Ship Elimination #89

Closed aeioiie closed 1 week ago

aeioiie commented 1 week ago

BUG SUMMARY

When the player killed all the enemy ship but doesn't move on to the next stage and freeze.

BUG DESCRIPTION

The screen stops momentarily when the enemy is killed. At this time, the level at which the screen stops is random.

Exception` in thread "main" java.lang.NullPointerException: Cannot read the array length because "image" is null
   at engine.DrawManager.drawEntity(DrawManager.java:253)
   at screen.GameScreen.draw(GameScreen.java:438)
   at screen.GameScreen.update(GameScreen.java:350)
   at screen.Screen.run(Screen.java:89)
   at screen.GameScreen.run(GameScreen.java:253)
   at engine.Frame.setScreen(Frame.java:59)
   at engine.Core.main(Core.java:172)

As far as I'm concerned, adding the following code to DrawEntivity's DrawManager.java's DrawEntity method will eliminate the bug, but it doesn't seem to be a fundamental solution. Please check carefully where the method is called.

if (image == null) {
    System.err.println("Error: Image not found for sprite type: " + entity.getSpriteType());
    return;
}

RUN SCREEN

https://github.com/user-attachments/assets/bc95e80b-e39b-44f7-bd5d-78739a6305ab

Guicha commented 1 week ago

This issue should be fixed as of our latest PR ! Dont hesitate to reach out for other feedbacks !

aeioiie commented 1 week ago

OK, I confirmed that this issue has solved by PR #87. Thanks!