Sign in to follow this  
SolenRae

I cannot get Phaser to work, yet I had it working on another project

Recommended Posts

Well I don't know what I am doing wrong anymore, and its keeping me up at nights! So if you are a kind soul out there, please, please help me correct my erroneous ways :)

Here is my index.html file:

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <title> Tutorial Endless Runner RPG </title>
        <script src="phaser.min.js" type="text-javascript"></script>
        <script src="boot.js" type="text-javascript"></script>
        <script src="preloader.js" type="text-javascript"></script>
        <script src="level001.js" type="text-javascript"></script>
    </head>
    <body>
        <script type="text-javascript">
            window.onload = function () {
            var game = new Phaser.Game(800, 600, Phaser.AUTO, '');

            game.state.add('Boot', Game.Boot);
            game.state.add('Preload', Game.Preloader);
            game.state.add('Level001', Game.Level001);

            game.state.start('Boot');
        };
        </script>
    </body>
    
</html>

The boot and preloader is pretty much empty, on create they boot the next game state. Which leads up to Level001, where I set the background color to some grey blueish color.

However, when I run the application (index.html) through xampp, I get nothing, not a squat. The problem with nothing is that it doesn't even display any sort of errors, which I in-turn interpret as some sort of linker error, like a null pointer or what not that is just fine with running because if there is null send somewhere, it doesn't do anything to begin with.

I've tried to move my files, changing the script src, I've tried rewrite my code, I followed guides, red others downfall, yet nothing so far has shed light upon the dank and gloomy code that I've written.

I am all out of aces, yet the battle hasn't even begun. Please let me have a fighting chance in this havoc :)

Share this post


Link to post
Share on other sites

Hey @SolenRae, just had a super quick look at the code and I noticed that you have "text-javascript", maybe try to write "text/javascript" (the correct form). I honestly never tried misspelling the type of a inlined script but maybe this could be quick to check :D 

Also try to add some 'window.alert("HELLO!")' in the onload function to see if the function gets called at all.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.