Skip to content

Commit 384cfdb

Browse files
committed
update sample
1 parent 164f2b0 commit 384cfdb

File tree

6 files changed

+32
-7
lines changed

6 files changed

+32
-7
lines changed

.github/workflows/deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
npm run build
2525
2626
- name: Deploy Phaser 3 TypeScript project to Walrus
27-
uses: zktx-io/[email protected].0
27+
uses: zktx-io/[email protected].4
2828
with:
2929
site-path: ${{ github.workspace }}/dist
3030
object-id: '0x6f39a12152a48d05038654b623ef3b0f63a78f60547553ec7a89e02b854a4a83'

package-lock.json

Lines changed: 5 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/assets/sui.png

6.2 KB
Loading

public/assets/walrus.png

9.27 KB
Loading

src/App.tsx

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,14 @@ function App()
5757
const y = Phaser.Math.Between(64, scene.scale.height - 64);
5858

5959
// `add.sprite` is a Phaser GameObjectFactory method and it returns a Sprite Game Object instance
60-
const star = scene.add.sprite(x, y, 'star');
60+
const textureKey = Math.random() < 0.5 ? 'walrus' : 'sui';
61+
const sprite = scene.add.sprite(x, y, textureKey);
6162

6263
// ... which you can then act upon. Here we create a Phaser Tween to fade the star sprite in and out.
6364
// You could, of course, do this from within the Phaser Scene code, but this is just an example
6465
// showing that Phaser objects and systems can be acted upon from outside of Phaser itself.
6566
scene.add.tween({
66-
targets: star,
67+
targets: sprite,
6768
duration: 500 + Math.random() * 1000,
6869
alpha: 0,
6970
yoyo: true,
@@ -80,6 +81,18 @@ function App()
8081

8182
}
8283

84+
const handleClick_1 = () => {
85+
window.open("https://docs.walrus.site/walrus-sites/intro.html", "_blank", "noopener,noreferrer");
86+
};
87+
88+
const handleClick_2 = () => {
89+
window.open("https://github.com/marketplace/actions/walrus-sites-ga", "_blank", "noopener,noreferrer");
90+
};
91+
92+
const handleClick_3 = () => {
93+
window.open("https://github.com/zktx-io/phaserjs-template-react-ts", "_blank", "noopener,noreferrer");
94+
};
95+
8396
return (
8497
<div id="app">
8598
<PhaserGame ref={phaserRef} currentActiveScene={currentScene} />
@@ -96,6 +109,15 @@ function App()
96109
<div>
97110
<button className="button" onClick={addSprite}>Add New Sprite</button>
98111
</div>
112+
<div>
113+
<button className="button" onClick={handleClick_1}>walrus</button>
114+
</div>
115+
<div>
116+
<button className="button" onClick={handleClick_2}>walrus sites ga</button>
117+
</div>
118+
<div>
119+
<button className="button" onClick={handleClick_3}>example github</button>
120+
</div>
99121
</div>
100122
</div>
101123
)

src/game/scenes/Preloader.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ export class Preloader extends Scene
3434

3535
this.load.image('logo', 'logo.png');
3636
this.load.image('star', 'star.png');
37+
this.load.image('sui', 'sui.png');
38+
this.load.image('walrus', 'walrus.png');
3739
}
3840

3941
create ()

0 commit comments

Comments
 (0)