-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Example code not working for "Creating a Basic Kiwi.js Game" #20
Comments
@DonLewi Thanks for the inquiry! I've taken a quick stab at reproducing the issue. I'm loading So in Firefox, it works. But in Chrome, it doesn't, with what appears to be the same error. Now, the repo adds a couple of things to the instructions in the tutorial. I don't have to run a deep analysis to guess at what's happening. There's a very clever "preload" function going on, which is intended to display logos and loading screens while the other game assets are loaded in. Unfortunately, this is a very light scene and doesn't require any such thing. More unfortunately, the clever bits are quite fragile. Basically, KiwiJS in the default WebGL render mode will load images onto the graphics card at the beginning of a State. The repo version of the scene wants to add things to the scene before that "library refresh". Unfortunately, the entities lose track of their former textures during the refresh, and things fall down. There are several ways to fix this. The quickest is to use Canvas rendering instead of WebGL. To do this, change the very first line in
to:
The hardest fix is to figure out why the library is crashing at all, and only on some browsers. I've made an issue to follow up on this at some point in the future. The middle fix is to strip out all the loading stuff. Take
(We remove mention of extra states, and load files in the single preload.) Then remove everything after
(We remove all the references to the extra states.) I should take the time to update the repo, but I'm away from my work machines, so it may have to wait a little while. Leaving the issue open for that followup. Hope this helps! |
Great explanation - very interesting. I will work with the workaround and see what's what. ++ for great support. |
Hey so I was walking through the tutorial and was struggling to get the character and jungle assets to be viewable. So I decided to run the example code and see how that worked - and it didn't work and throws an undefined error in kiwi.js.
I am running the kiwi.js file downloaded from the main site today and am serving it locally using npm http-server
here is a pic of my console
The text was updated successfully, but these errors were encountered: