RoadKillCandy Posted July 12, 2020 Share Posted July 12, 2020 So I was fallowing along an online tutorial phaser-101-introduction-to-game-development and I just can't get my game to appear. The error is Failed to load resource: the server responded with a status of 404 (Not Found) The tutorial said it HAD to be on a web site you built or whatever to get it to load right so I made one and nothing the broken phaser game . Just not sure how its not reading it I downloaded everything into the right folders and have all the path names right. <!doctype html> <html lang="en"> <head> <meta charset="UTF-8" /> <title>Welcome to Road Kill Candy's Games</title> <script type="text/javascript" src="http://gc.kis.v2.scr.kaspersky-labs.com/FD126C42-EBFA-4E12-B309-BB3FDD723AC1/main.js?attr=JSM1EvLROPX115ml3uJbdZZ-lwwpEqPUC2arVNOQbbGahJ1RiZ8YWfXBj7TZ_E-MoEEEFjmFPyuFom0EN7r95ZXWq76bQYINoAUdkEjhwZw" charset="UTF-8"></script><link rel="stylesheet" crossorigin="anonymous" href="http://gc.kis.v2.scr.kaspersky-labs.com/E3E8934C-235A-4B0E-825A-35A08381A191/abn/main.css?attr=aHR0cDovL3JvYWRraWxsY2FuZHkuYXR3ZWJwYWdlcy5jb20vaW5kZXgyLmh0bWw"/><style> canvas { width: 100%; } </style> </head> <body> <script src="">js/phaser.js</script> <script src="">js/game.js</script> </body> <center> <a href="index.html"> Back</a></center> <br> <center> <a href="https://mrskaiba.wixsite.com/nerdyglamor"> <img src="/assets/saturnd.png"></a><br><br> You have to enable JavaScript in the Bowser to play </center> </html> and the game code looks like / create a new scene let gameScene = new Phaser.Scene('Game'); // load assets gameScene.preload = function(){ // load images this.load.image('background', 'assets/background2.png'); this.load.image('player', 'assets/player2.png'); this.load.image('player', 'assets/dragon2.png'); this.load.image('player', 'assets/treasure2.png'); }; // called once after the preload ends gameScene.create = function() { // create bg sprite let bg = this.add.sprite(0, 0, 'background'); // change the origin to the top-left corner //bg.setOrigin(0,0); // place sprite in the center bg.setPosition(640/2, 360/2); let gameW = this.sys.game.config.width; let gameH = this.sys.game.config.height; console.log(gameW, gameH); console.log(bg); console.log(this); }; // create the player this.player = this.add.sprite(70, 180, 'player'); // we are reducing the width by 50%, and we are doubling the height this.player.setScale(0.5); // create an enemy this.enemy1 = this.add.sprite(250, 180, 'enemy'); this.enemy1.scaleX = 2; this.enemy1.scaleY = 2; // this is called up to 60 times per second gameScene.update = function(){ //this.enemy1.x += 1; this.enemy1.angle += 1; // check if we've reached scale of 2 if(this.player.scaleX < 2) { // make the player grow this.player.scaleX += 0.01; this.player.scaleY += 0.01; }; // check if we've reached scale of 2 if(this.player.scaleX < 2) { // make the player grow this.player.scaleX += 0.01; this.player.scaleY += 0.01; // create a second enemy this.enemy2 = this.add.sprite(450, 180, 'enemy'); this.enemy2.displayWidth = 300; // flip this.enemy1.flipX = true; this.enemy1.flipY = true; // set the configuration of the game let config = { type: Phaser.AUTO, // Phaser will use WebGL if available, if not it will use Canvas width: 640, height: 360, scene: gameScene }; // create a new game, pass the configuration let game = new Phaser.Game(config); Link to comment Share on other sites More sharing options...
RoadKillCandy Posted July 12, 2020 Author Share Posted July 12, 2020 oh and thanks do who ever looked over it. Link to comment Share on other sites More sharing options...
Recommended Posts