Skip to content

Commit aa5e14a

Browse files
committed
add transitionToStage
1 parent bc10853 commit aa5e14a

10 files changed

Lines changed: 456 additions & 238 deletions

File tree

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,18 @@ index: 4
44
lang: en
55
---
66

7+
## 4.19.0
8+
9+
- 🚀 Feat: Add transitionToStage method to Window class.
10+
11+
You can now use the transitionToStage method for a smoothing transition between the current and the new stage.
12+
13+
```java
14+
window.transitionToStage(new MyStage(), 500);
15+
```
16+
17+
The DonutIO example shows the usage of the transitionToStage method.
18+
719
## 4.18.1
820

921
- 🐛 Fix: isTouchingSprite not working correctly, when the sprite is resized.

examples/java/DonutIO/Game.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public Game() {
1414
}
1515

1616
public static void main(String[] args) {
17-
Text.FONT_SIZES = new int[] {32, 48};
17+
Text.FONT_SIZES = new int[] { 32, 48 };
1818
new Game();
1919
}
2020
}

examples/java/DonutIO/GameOverStage.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public void whenKeyPressed(int keyCode) {
3030
System.out.println(keyCode);
3131
if (keyCode == KeyCode.VK_SPACE) {
3232
Game.LEVEL = 0;
33-
Window.getInstance().setStage(new WorldStage());
33+
Window.getInstance().transitionToStage(new WorldStage(), 500);
3434
}
3535
}
3636
}

examples/java/DonutIO/StartStage.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public StartStage() {
3737
public void whenKeyPressed(int keyCode) {
3838
if (keyCode == KeyCode.VK_SPACE) {
3939
Game.LEVEL = 0;
40-
Window.getInstance().setStage(new WorldStage());
40+
Window.getInstance().transitionToStage(new WorldStage(), 500);
4141
}
4242
}
4343
}

examples/java/DonutIO/WinStage.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public WinStage() {
2929
public void whenKeyPressed(int keyCode) {
3030
if (keyCode == KeyCode.VK_SPACE) {
3131
Game.LEVEL += 1;
32-
Window.getInstance().setStage(new WorldStage());
32+
Window.getInstance().transitionToStage(new WorldStage(), 500);
3333
}
3434
}
3535
}

examples/java/DonutIO/WorldStage.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,13 @@ public void run() {
5353
}
5454

5555
if (this.count(FollowDonut.class) == 0) {
56-
Window.getInstance().setStage(new WinStage());
56+
Window.getInstance().transitionToStage(new WinStage(), 500);
57+
return;
5758
}
5859

5960
if (this.count(PlayerDonut.class) == 0) {
60-
Window.getInstance().setStage(new GameOverStage());
61+
Window.getInstance().transitionToStage(new GameOverStage(), 500);
62+
return;
6163
}
6264

6365
if (this.isKeyPressed(KeyCode.VK_1)) {

resources/build.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ author.url=https://openpatch.org
4040
# This is NOT a direct link to where to download it.
4141

4242
library.url=https://github.com/openpatch/scratch-for-java
43-
library.version=4.18.1
43+
library.version=4.19.0
4444

4545

4646
# Set the category (or categories) of your Library from the following list:

0 commit comments

Comments
 (0)