Jump to content

Error with simple example using Phaser 2.7.9


bob
 Share

Recommended Posts

Hi there,

I am a complete Phaser newbie and have followed the "Getting Started" guide here: https://phaser.io/tutorials/getting-started/part6. The Hello World example there, which just loads and displays an image, uses Phaser 2.5.0, but I would like to use the latest CE release. However, when I change the <script> tags to use a locally downloaded copy of phaser.js (2.7.9) I get hundreds of errors in my Javascript console in both Firefox (47):

Fs6hdYa.png

and Chromium (51):

ZnnCZOx.png

The example does still seem to work (the image appears), but as far as I can tell these errors occur continuously as long as the code is running, so obviously I don't want to continue until they're fixed. There were no errors using Phaser 2.5.0, and 2.6.2 also works fine. Any ideas?

Edit: Since the example is so simple I figure I might as well post the complete code here:

<!doctype html>
<html>
    <head>
        <meta charset="UTF-8" />
        <title>hello phaser!</title>
        <!--<script src="//cdn.jsdelivr.net/phaser/2.5.0/phaser.min.js"></script>-->
        <script src="phaser.js"></script>
    </head>
    <body>

    <script type="text/javascript">

    window.onload = function() {

        //  Note that this html file is set to pull down Phaser 2.5.0 from the JS Delivr CDN.
        //  Although it will work fine with this tutorial, it's almost certainly not the most current version.
        //  Be sure to replace it with an updated version before you start experimenting with adding your own code.

        var game = new Phaser.Game(800, 600, Phaser.AUTO, '', { preload: preload, create: create });

        function preload () {

            game.load.image('logo', 'phaser.png');

        }

        function create () {

            var logo = game.add.sprite(game.world.centerX, game.world.centerY, 'logo');
            logo.anchor.setTo(0.5, 0.5);

        }

    };

    </script>

    </body>
</html>

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...