Discord
Login
Community
DARK THEME

How Do I Know If My Game Has Loaded?

^^^

Your init() function is called after:

  • All your sprites are loaded and ready
  • All your maps are loaded and ready
  • All your code files are loaded (thus all your classes or functions are available to use)

Sounds are loaded asynchronously, thus they may still be unavailable when init() is called. You can check if a sound is available by testing property sounds["mysound"].buffer (as in if sounds["mysound"].buffer then (...) end) ; I plan to add a ready flag but it is not done yet, testing buffer will do the trick!

Music is streamed from the server, you do not need to check anything before starting to play a music file.

When you run your project in a separate tab (new tab), sound and music cannot start playing before a first click is made in the game window. This is a restriction of web browsers, to prevent web sites from playing music just when you open the page. This limitation disappears when the game is built for Win/Mac/Lin.

Post a reply

Progress

Status

Preview
Cancel
Post
Validate your e-mail address to participate in the community