rich Posted April 19, 2013 Author Share Posted April 19, 2013 Is render being called? Stick a console.log in there and see (same for the other functions just to be sure). Link to comment Share on other sites More sharing options...
Tácio Sousa Posted April 19, 2013 Share Posted April 19, 2013 I put one console.log in render and nothing was showed, so the render is not being called. How a call him manually? Edit : Same to the other functions, none of them is being called. Edit 2 : I put this.render(); in init and the console was called in render funcion, but the texts still don't add. Main = function (game){ this.game = game;}Main.prototype ={ init : function() { this.game.camera.backgroundColor = 'rgb(50,50,50)'; this.render(); }, create : function() { }, update : function() { }, render : function() { this.game.stage.context.fillStyle = 'rgb(255,255,255)'; this.game.stage.context.font = 'bold 48px Arial'; this.game.stage.context.textAlign = 'center'; this.game.stage.context.fillText("Teste", 10, 20); console.log("test"); }} Link to comment Share on other sites More sharing options...
rich Posted April 19, 2013 Author Share Posted April 19, 2013 Could you email me your project files please? [email protected] - thanks Link to comment Share on other sites More sharing options...
Tácio Sousa Posted April 19, 2013 Share Posted April 19, 2013 I send the files for your email, thanks Rich. Edit : You receive the email? =x Link to comment Share on other sites More sharing options...
rich Posted April 20, 2013 Author Share Posted April 20, 2013 Ok I know what the problem was. You had an init function, but you didn't load any files - so loader never got to call 'create' or start the game loop. However I've fixed this in v0.9.2 which I just pushed. It will call init and if the loader is still empty it'll automatically call create like it should Link to comment Share on other sites More sharing options...
Tácio Sousa Posted April 22, 2013 Share Posted April 22, 2013 Hi Rich, i'm here again to boring you one more time. I exchange the files for the new version 0.92 and update the index, and now he shows a new error : "Uncaught time error : undefined is not a funcion", but i don't change nothing in all code, before the Phaser cannot calls the "init", and now he searching for "undefined" method?I have only 2 files, the index and one Main.js, can you help me again?Index : <!DOCTYPE html><html><head> <title></title> <script src = "Phaser/phaser.js"></script> <script src = "Main.js"></script></head><body> <div id="game"></div> <script type="text/javascript"> var myGame = new Phaser.Game(this, 'game', 800, 600); myGame.switchState(Main); </script></body></html> Main.js :Main = function (game){ this.game = game;}Main.prototype ={ init : function() { this.game.camera.backgroundColor = 'rgb(50,50,50)'; //this.render(); }, create : function() { }, update : function() { }, render : function() { /*this.game.stage.context.fillStyle = 'rgb(255,255,255)'; this.game.stage.context.font = 'bold 48px Arial'; this.game.stage.context.textAlign = 'center'; this.game.stage.context.fillText("Teste", 10, 20); console.log("test");*/ }} Link to comment Share on other sites More sharing options...
rich Posted April 22, 2013 Author Share Posted April 22, 2013 What browser? (and browser version). The time error sounds like maybe something that doesn't support Date.now perhaps. Do the examples on here run for you: http://gametest.mobi/phaser/ ? (I just updated them all to 0.9.2 to be sure). Link to comment Share on other sites More sharing options...
Tácio Sousa Posted April 22, 2013 Share Posted April 22, 2013 I use Google Chrome version 26.0.1410.65, and now that you say...all the examples of test page don't running more in my browser x.x.Can you give me a suggestion for what i do? T-T Edit : The console in browser says : Uncaught ReferenceError: Phaser is not defined. (For all the examples) Link to comment Share on other sites More sharing options...
rich Posted April 22, 2013 Author Share Posted April 22, 2013 Ok that's interesting - I'm using the same version as you and also the latest Canary build and they are running without error. Can you bring up the dev console settings and make sure Disable cache is set. Also do you have any extensions loaded at all? Does it do the same for other browsers? I just tried Firefox 20.0.1 on the gametest links and they running ok. Do the examples on gametest.mobi run for you (or just broken locally)? Link to comment Share on other sites More sharing options...
Tácio Sousa Posted April 22, 2013 Share Posted April 22, 2013 I empty the cache and now the examples are running (one problem less thanks Rich o/), but my test code continues with the same problem : "undefined is not a funcion", so the problem is not more the browser i think...I know any way to resolve the Date.now problem? (if is really this the problem) Link to comment Share on other sites More sharing options...
rich Posted April 22, 2013 Author Share Posted April 22, 2013 Do you still get the "undefined time error" ? Chrome handles Date.now just fine - it's old browsers like IE8 that don't. When you see the error in the dev console it should have the little arrow next to it that lets you expand where it occurred, and also a line-number next to it (on the far right) - if you click the line number it will open phaser.js and show you the line with the error - please copy/paste or screen grab to me Link to comment Share on other sites More sharing options...
Tácio Sousa Posted April 22, 2013 Share Posted April 22, 2013 He said "Type Error" in index.html, not Time Error. I put the image here for you look. Link to comment Share on other sites More sharing options...
Chris Posted April 22, 2013 Share Posted April 22, 2013 Looks like Parser is trying to call a callback that is not defined. Link to comment Share on other sites More sharing options...
rich Posted April 22, 2013 Author Share Posted April 22, 2013 Hmm nothing in there has changed, but for now don't use the switchState method but instead just define the functions directly in the html (like all the test cases do) Link to comment Share on other sites More sharing options...
Tácio Sousa Posted April 22, 2013 Share Posted April 22, 2013 Believing or not...i put all in html and he throws the same problem ("Uncaught TypeError : undefined is not a funcion")...he is the all code : <!DOCTYPE html><html><head> <title></title> <script src = "Phaser/phaser.js"></script> <!-- <script src = "Main.js"></script>--></head><body> <div id="game"></div> <script type="text/javascript"> //var myGame = new Phaser.Game(this, 'game', 800, 600); //myGame.switchState(Main); /// <reference path="Phaser/Game.ts" /> (function () { var myGame = new Phaser.Game(this, 'game', 840, 400, init, create, update); function init() { myGame.camera.backgroundColor = 'rgb(50,50,50)'; } function create() { } function update() { } })(); </script></body></html> I know that i'm turning a annoying person, but i really want make the Phaser work, so please forgive me for my "spam question posts". Link to comment Share on other sites More sharing options...
Tácio Sousa Posted April 23, 2013 Share Posted April 23, 2013 Can anyone imagine what's that problem with the "undefined" function? =/ Link to comment Share on other sites More sharing options...
rich Posted April 23, 2013 Author Share Posted April 23, 2013 Not yet, but don't worry I've not forgotten about it - am going over the way they handle it in jQuery 2 and borrowing that method instead It will be on 0.9.3 for sure (hopefully tonight). Link to comment Share on other sites More sharing options...
Hsaka Posted April 23, 2013 Share Posted April 23, 2013 Hi, I'm able to reproduce your problem. You can fix it by referencing one of the phaser.js builds in the build folder of the distribution instead of the one in the Phaser folder: <head> <script src = "build/phaser-092.js"></script></head> Link to comment Share on other sites More sharing options...
Tácio Sousa Posted April 23, 2013 Share Posted April 23, 2013 Thanks for the support Rich, you are awesome!And thanks for you too Hsaka, i change the reference as you said and now FINALLY the code works! Very thanks! Link to comment Share on other sites More sharing options...
rich Posted April 24, 2013 Author Share Posted April 24, 2013 Let me know if 0.9.3 fixed this for you please Link to comment Share on other sites More sharing options...
Tácio Sousa Posted April 24, 2013 Share Posted April 24, 2013 Hi Rich, i put the 0.9.3 version in folder, run again, and the problem still continues... If you put the reference with "Phaser/phaser.js", the undefined function error appears one more time, and only run normally if change to "build/phaser-093.js" reference as the Hsaka said. Link to comment Share on other sites More sharing options...
rich Posted April 24, 2013 Author Share Posted April 24, 2013 Honestly I now think it's a cache issue. Indulge me here - rename Phaser/phaser.js to Phaser/tacio.js and update your html. Does it then work? Link to comment Share on other sites More sharing options...
Tácio Sousa Posted April 24, 2013 Share Posted April 24, 2013 Don't work...I don't know if my organization is right, but i'll put the codes here, and one screen of my folder here for you see if i'm doing anything wrong. (The project folder is the top finder) HTML :<!DOCTYPE html><html><head> <title></title> <script src = "build/phaser-093.js"></script> <!--<script src = "Phaser/phaser.js"></script>--> <script src = "Main.js"></script></head><body> <div id="game"></div> <script type="text/javascript"> var myGame = new Phaser.Game(this, 'game', 800, 600); myGame.switchState(Main); </script></body></html> JS : Main = function (game){ this.game = game;}Main.prototype ={ init : function() { this.game.camera.backgroundColor = 'rgb(50,50,50)'; }, create : function() { }, update : function() { }, render : function() { this.game.stage.context.fillStyle = 'rgb(255,255,255)'; this.game.stage.context.font = 'bold 20px Arial'; this.game.stage.context.textAlign = 'center'; this.game.stage.context.fillText("Teste", 50, 50); }}Phaser folder : Build folder : I hope that this help you. Link to comment Share on other sites More sharing options...
rich Posted April 24, 2013 Author Share Posted April 24, 2013 Ah-ha! Ok yes that explains it. You're linking to just the compiled version of the Phaser.ts file, which of course has virtually nothing in it! I thought you were linking to the version in the Tests folder (that would work fine). Or just use the one in the build folder, it really doesn't matter which. There isn't a compiled version of the full thing in the Phaser folder itself, it gets compiled to /build and /Tests. Link to comment Share on other sites More sharing options...
Tácio Sousa Posted April 24, 2013 Share Posted April 24, 2013 Humm, i know that this .js was so much empty XD.So, i need to put always the Phaser folder, together with the latest version of the phaser.js in build or test folder, in my project folder for works right? Is it? Anyway, thanks for your super support Rich, i hope that the Phaser continues increasing day by day with your hands, and i'll use him always when i need. Link to comment Share on other sites More sharing options...
Recommended Posts