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
Quitnus not loading assets #193
Comments
Did you look at the Network tab in your DevTools? What URL is being loaded? What error do you get? |
There is nothing in the network tab at all, and on every file it says |
This is weird. You should see the network queries in the Network tab. Does the Console provide more info about what's going on? |
Please post the code you use to load those assets and the structure of your files. Note that you will need a web server to load external files via XHR. |
What version are you using from the CDN? What does the Network tab show exactly? |
I am using v0.2.0 as it said in the tutorial on the Quintus home page. The Network tab shows nothing in both Firefox and Google Chrome. |
It's weird that no XHR request is sent. Have you tried using an Have you specified an |
I tried using a |
But have you used the A simple |
May I ask how I would use that? I am a hobbyist programmer and Javascript is not my best language. Say if my function is set up like so: var filestoload = ['test.tmx', 'rndgrsstile.png', 'player01.png', 'tower01.png', 'enemy01.png'];
Q.load(filestoload,
function() {
Q.stageScene("level1");
}); How would I integrate the |
In the third parameter (not set here), pass an object with a Q.load(files, cb, { errorCallback: (err) => { console.dir(err) } }); |
I got that to work after a bit of trial and error, in the end this worked out well: var filestoload = ['test.tmx', 'rndgrsstile.png', 'player01.png', 'tower01.png', 'enemy01.png'];
var startlevel1 = function(){
Q.stageScene('level1');
console.log("First level loaded!");
};
var errorCallback = function(err){
console.dir(err);
};
Q.loadTMX(filestoload,startlevel1(), errorCallback(err)); The error it throws out is this: |
Could you give me the whole error (including the line number and call stack)? |
Here is a screenshot of the full error: |
Looks like the problem is your TMX file, not the assets loading. And I just took a closer look at your code: Q.loadTMX(filestoload,startlevel1(), errorCallback(err)); This does 3 things:
Your code should look more like this: Q.load(filestoload, startlevel1, { errorCallback: errorCallback }); |
That removed the error entirely, but still nothing shows up at all on the screen. I shortened my code to this to minimize errors, as all I am trying to do is get a simple level rendered: var startlevel1 = function(){
Q.stageScene('level1');
console.log("First level loaded!");
};
var firstlevelfiles = ['test.tmx', 'rndgrsstile.png'];
window.addEventListener('load', function(){
var Q = window.Q = Quintus().include("Scenes, TMX").setup({maximize:true});
Q.scene("level1", function(stage){
Q.stageTMX('test.tmx', stage);
stage.add('viewport');
});
Q.load(firstlevelfiles, startlevel1, { errorCallback: (err) => { console.dir(err) } });
}); Here is the HTML code if you were wondering: <!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0"/>
<script src='http://cdn.html5quintus.com/v0.2.0/quintus-all.js'></script>
<script src='game.js'></script>
<style>
body { padding:0px; margin:0px; }
</style>
</head>
<body>
</body>
</html> |
I've never used TMX files, but as long as everything is loaded, all that's left todo is add some logs to see which functions have been called or not. Also check the docs to make sure you didn't miss anything on the TMX use process. |
The 404 is related to the You do have a syntax error in your file, though, on line 16. |
This error doesn't show on Firefox, only Chrome. The line that the error is occurring is |
It's not syntactically correct as there is one closing bracket too many. Firefox should have seen it too. |
You should check that the files are in the right folders then. Quintus looks up files in dedicated directories by default. Make sure you follow the specs. |
I got the assets to load finally, and the world loads in. I don't know where the level itself is but I think i can figure it out by tinkering with the X and Y on the character I added. Thanks for the help! |
I copied the code from the basic Quintus platformer from the website home page with the same assets and nothing is loading. I tried running the game from a webserver (more specifically mongoose server) which also didn't work. The assets were being loaded with the
Q.load
function.The text was updated successfully, but these errors were encountered: