• Content Count

  • Joined

  • Last visited

About joshcawthorne

  • Rank

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Hi all, I'm using Phaser CE (latest edition), and looking to create a responsive game. At the moment, my canvas and sprites respond well to the window being resized whilst I use: game.scale.scaleMode = Phaser.ScaleManager.RESIZE; However, my scrolling tileSprite repeats itself on a big enough screen (see here: Is it possible to have the tileSprite's height fill the screen, and the width automatically resize accordingly? Thanks!
  2. Hi all, I have code for a crystal count within my level at the moment, however when the player dies and the level resets, or when the player moves on to level 2 (in a new js file), the score resets as I've initiated it within level 1. Could someone please tell me how to create a variable that can be tracked and edited in every JS file, rather than just one? Thanks!
  3. Hi all, I'm trying to create a coin counter in my game, using a bitmap font. Everything displays fine, and the counter works, however when a player collects a new coin, rather than replacing the '0' with a '1', it shows a '1', but underneath you can still see a '0' visibly. I've tried several work around methods, including even doing an if statement checking how many coins and replacing it with plain text rather than replying on the var count, and using coinText.updateText();. Does anyone have any ideas? I'll leave my code sample below. var crystalCount = 0; var coinText; //Skip down to the update section coinText =, 10, 'carrier_command', "Crystals:" + crystalCount, 12); coinText.updateText();
  4. You were right, I've been wracking my brain for days trying to sort this! Thanks so much for your help!
  5. I've been working on a Phaser game for a project at university. All of this is relatively new stuff to me, so I'm learning on the fly. I've managed to create a simple tilemap using Tiled, and got it to import to Phaser successfully. However, I can't make the player collide with the 'platform' layer, and I've tried just about everything I can find online. I've cut down my game code to just what's needed for you to (hopefully) point out my error, but it all runs without errors usually. I can also upload any JSON or Image files that might be needed. var SuddenGame = SuddenGame || {}; var char; var map; // GAMEPLAY STATE // SuddenGame.playState = function() {}; SuddenGame.playState.prototype = { init: function() { = true; }, create: function() { //Setup FPS Counter = true; //Stop game from pausing if a player tabs out this.stage.disableVisibilityChange = true; //Import and play background music music ='menumusic');'', 0, 1, true); //Create Dotted Background this.background =, -'background').height,,'background').height, 'background' ); this.dots =, -'dots').height,,'dots').height, 'dots' ); //Enable Physics Engine; //Add level one tilemap map ='levelone'); map.addTilesetImage('scifi_platformTiles_32x32', 'scifi_platformTiles_32x32'); backgroundTiles = map.createLayer('backgroundLayer'); Objective = map.createLayer('Objective'); Platform = map.createLayer('Platform');; this.physics.arcade.enable(Platform); map.setCollisionBetween(1, 1000, true, 'Platform'); Platform.resizeWorld(); Platform.debug = true; this.char = this.add.sprite(50, 470, 'hero'); this.physics.arcade.enable(this.char); this.char.body.gravity.y = 1300; this.char.body.collideWorldBounds = true; this.char.scale.setTo(2, 2); //Create Player Animations var idle = this.char.animations.add('idle', [0]); var walk = this.char.animations.add('walk', [0, 1, 2, 1]);; }, update: function() {, Platform); this.physics.arcade.TILE_BIAS = 40; if ( && !this.char.body.touching.left) { this.char.body.velocity.x = -150;'backwalk', 10, true); } else if ( && !this.char.body.touching.right) { this.char.body.velocity.x = 150;'walk', 10, true); } else if ( {'die', 10, true); } else { this.char.body.velocity.x = 0;'idle', 7, true); } if ( && > jumpTimer) { {'jump', 10); this.char.body.velocity.y = -1000; jumpTimer = + 750; } } //if (this.cursors.up.isDown && !this.char.body.touching.down ) { if ( && && this.char.body.touching.left && > jumpTimer) { this.char.body.velocity.y = -500; jumpTimer = + 1; } if ( && && this.char.body.touching.right) { this.char.body.velocity.y = -500; this.char.body.velocity.x = -2500; //jumpTimer = + 1; } //More update code here }, render: function() { || '--', 2, 14, "#00ff00"); } } Apologies if I've missed an extremely obvious mistake!