Update app.py
Browse files
app.py
CHANGED
@@ -5,6 +5,12 @@ load_js="""src='https://cdn.jsdelivr.net/npm/[email protected]/dist/phaser.js'
|
|
5 |
|
6 |
|
7 |
game_js="""
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
var config = {
|
9 |
type: Phaser.AUTO,
|
10 |
width: 800,
|
@@ -191,6 +197,8 @@ function hitBomb (player, bomb)
|
|
191 |
|
192 |
gameOver = true;
|
193 |
}
|
|
|
|
|
194 |
|
195 |
"""
|
196 |
|
@@ -208,6 +216,8 @@ with gr.Blocks() as app:
|
|
208 |
</style>
|
209 |
</head>
|
210 |
<body>
|
|
|
|
|
211 |
</body>
|
212 |
</html>""")
|
213 |
|
|
|
5 |
|
6 |
|
7 |
game_js="""
|
8 |
+
|
9 |
+
async () => {
|
10 |
+
// set testFn() function on globalThis, so you html onlclick can access it
|
11 |
+
globalThis.testFn = () => {
|
12 |
+
|
13 |
+
|
14 |
var config = {
|
15 |
type: Phaser.AUTO,
|
16 |
width: 800,
|
|
|
197 |
|
198 |
gameOver = true;
|
199 |
}
|
200 |
+
}
|
201 |
+
}
|
202 |
|
203 |
"""
|
204 |
|
|
|
216 |
</style>
|
217 |
</head>
|
218 |
<body>
|
219 |
+
<button type="testButton" onclick="testFn()"> Start </button>
|
220 |
+
|
221 |
</body>
|
222 |
</html>""")
|
223 |
|