Skip to content

Commit 670b073

Browse files
committed
fix(tutorial): notify player if their waypoint is too far away
1 parent 6285bb1 commit 670b073

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

engine/src/main/java/org/destinationsol/game/tutorial/TutorialManager.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,9 @@ public void start() {
221221
new ButtonPressStep(solGame.get().getScreens().mapScreen.getZoomInButton(), "Zoom In"),
222222
new ButtonPressStep(solGame.get().getScreens().mapScreen.getZoomOutButton(), "Zoom Out"),
223223
new MapDragStep("You can drag the map to move around."),
224-
new CreateWaypointStep("Create a waypoint near your ship."),
224+
new CreateWaypointStep("Create a waypoint near your ship.",
225+
"That's too far away.\n\n" +
226+
"Remove it and place one closer to your ship."),
225227
new CloseScreenStep(
226228
solGame.get().getScreens().mapScreen.getCloseButton(),
227229
solGame.get().getScreens().mapScreen,

engine/src/main/java/org/destinationsol/game/tutorial/steps/CreateWaypointStep.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ public class CreateWaypointStep extends TutorialStep {
3636
@Inject
3737
protected GameScreens gameScreens;
3838
private final String message;
39+
private final String waypointTooFarMessage;
3940
private UIWarnButton addWaypointButton;
4041
private boolean buttonPressed = false;
4142
private int lastWaypointCount;
@@ -45,8 +46,9 @@ protected CreateWaypointStep() {
4546
throw new RuntimeException("Attempted to instantiate TutorialStep via DI. This is not supported.");
4647
}
4748

48-
public CreateWaypointStep(String message) {
49+
public CreateWaypointStep(String message, String waypointTooFarMessage) {
4950
this.message = message;
51+
this.waypointTooFarMessage = waypointTooFarMessage;
5052
}
5153

5254
public void start() {
@@ -66,12 +68,16 @@ public boolean checkComplete(float timeStep) {
6668
}
6769

6870
Hero hero = game.getHero();
71+
if (hero.getWaypoints().size() == 0) {
72+
setTutorialText(message);
73+
}
74+
6975
if (hero.getWaypoints().size() > lastWaypointCount) {
7076
Waypoint waypoint = hero.getWaypoints().get(hero.getWaypoints().size()-1);
7177
if (waypoint.getPosition().dst(hero.getPosition()) < 100.0f) {
7278
return true;
7379
} else {
74-
hero.removeWaypoint(waypoint);
80+
setTutorialText(waypointTooFarMessage);
7581
}
7682
}
7783
lastWaypointCount = game.getHero().getWaypoints().size();

0 commit comments

Comments
 (0)