Nikita99 Posted August 10, 2014 Share Posted August 10, 2014 Hi there I am trying to get Phaser to work I am using xampp Apache and Brackets but when I run this code:<!DOCTYPE html><html><head><script src="phaser.js"></script></head><body><div><script>var game = new Phaser.Game(1000, 800, Phaser.AUTO, '', { preload:preload, create: create, render: render });function preload(){game.load.spritesheet('hero','heroes1.png');}function create(){hero = game.add.sprite('hero');}function render(){}</script><div></body></html> In the console it says "Uncaught ReferenceError: preload is not defined" I will appriciate if someone can help me salcapolupo 1 Link to comment Share on other sites More sharing options...
DELETE THIS ACC PLS Posted August 10, 2014 Share Posted August 10, 2014 I think it's because the first line of your script. I don't write it like that. I had this kind of problem before.Try to replace it with this:var game = new Phaser.Game(1000, 800, Phaser.AUTO, '');It works fine with me. salcapolupo 1 Link to comment Share on other sites More sharing options...
lewster32 Posted August 10, 2014 Share Posted August 10, 2014 This should work as is. If I paste your code into jsFiddle with Phaser included it works. I'd try putting your var game bit after your functions but it really shouldn't make a difference. Link to comment Share on other sites More sharing options...
salcapolupo Posted February 14, 2015 Share Posted February 14, 2015 Had similar problem here, solved with Hady Hayman suggestion. DELETE THIS ACC PLS 1 Link to comment Share on other sites More sharing options...
Recommended Posts