| Summary: | When the sprite moves to the boundary of the map, the game does not end | ||
|---|---|---|---|
| Product: | CS3343_Kunkun_Loves_English | Reporter: | shangpguo2 |
| Component: | Algorithm | Assignee: | xuezhwang2-c |
| Status: | RESOLVED FIXED | ||
| Severity: | critical | ||
| Priority: | --- | ||
| Version: | 1.0 | ||
| Hardware: | PC | ||
| OS: | Mac OS | ||
|
Description
shangpguo2
2021-11-20 12:56:41 HKT
(In reply to shangpguo2 from comment #0) > Summary: > > As described in the game logic, we lose when the sprite moves to the > boundary of the map. Precisely, we enter too many wrong answer such that > Kunkun escapes. Nevertheless, when I lost, the sprite kept still at the > boundary and the game did not proceeded to next scene. > > Steps to reproduce: > > 1. enter the game and click "GRE" button. > 2. In the playing scene, you keep clicking the basketball at (1,1), and > enter the wrong answer. > 3. You repeat step 2, until kunkun is on the boundary. > > Expected Result: > > It is expected that when the sprite moves to the boundary, the playing scene > will proceed to ending scene. > > Actual Result: > > We still remain at the playing scene. > > Possible bug: > > I doubt that in the algorithm part, when you deal with the ending situation > of function BFS(). You do not handle it correctly. Hi, Shangping. After testing my algorithm with some additional test case. I think the problem is not caused by the algorithm which is actually correct. Then I test the Dio.java class which is the sprite's class. I found this failure is caused by some bugs in it. I change the component you submitted to scene, since the bug is caused by PlayingScene.java. In PlayingScene, there is a function: @Override public void update() { handleMouseClick(mouse); handleKeyboardInput(key); dio.upadateAnimationSequencePerFrame(); if(!dio.isAlive()) { toNextScene = true; gameResult.setIsWin(true); } } which will decide whether in next iteration of loop, we proceed to next scene. It is noticed that when Dio is dead, we proceed to next scene. Actually, there is a second possibility, where we can proceed to next scene if Dio successfully escapes. i fix this bug by doing the following. @Override public void update() { handleMouseClick(mouse); handleKeyboardInput(key); dio.upadateAnimationSequencePerFrame(); if(dio.isEscape()) { toNextScene = true; gameResult.setIsWin(false); } else if(!dio.isAlive()) { toNextScene = true; gameResult.setIsWin(true); } } |