BlueGit

timfa frameworkv3

add preloadThenStart

timfa Tim · pushed by timfa

Authored 2022-10-18 · 4 years ago

Hash
9dbbce66656e328cbfca5c7b2127520ed4a7cc72
Parent
6c4ab492
1 file changed +13 −0
framework/engine/game.js +13 −0
@@ -17,6 +17,19 @@ class Game
17 17 GameInput.g_init();
18 18 }
19 19
20 preloadImagesThenStart(imageData)
21 {
22 const cont = async () => {
23 await game.preloadImages(
24 imageData
25 );
26
27 game.startGame();
28 }
29
30 cont.apply();
31 }
32
20 33 async preloadImages(imagesData) {
21 34 const promises = [];
22 35 const context = this;
@@ -17,6 +17,19 @@ class Game
17 GameInput.g_init();
17 GameInput.g_init();
18 }
18 }
19
19
20 preloadImagesThenStart(imageData)
21 {
22 const cont = async () => {
23 await game.preloadImages(
24 imageData
25 );
26
27 game.startGame();
28 }
29
30 cont.apply();
31 }
32
20 async preloadImages(imagesData) {
33 async preloadImages(imagesData) {
21 const promises = [];
34 const promises = [];
22 const context = this;
35 const context = this;