Search the Community

Showing results for tags 'phaser'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • HTML5 Game Coding
    • News
    • Game Showcase
    • Coding and Game Design
  • Frameworks
    • Phaser 3
    • Phaser 2
    • Pixi.js
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



Website URL





Found 3,282 results

  1. Thunderfist

    Property 'width'

    I can't figure this out. My game code keeps saying that it can't read the property 'width' of undefined. There's nothing my code declaring a property width. Most of the locations are different lines in the phaser.js, but two of them are in the game.js: game.js lines 25, and 32. Line 25 is this.loadLevel(); and line 32 is = this.add.tilemap(this.currentLevel); Here's the code: /*global Phaser*/ var RPG = RPG || {}; RPG.GameState = { init: function (currentLevel) { //Needed to keep track of the level this.currentLevel = currentLevel || currentLevel === 'testroom1'; //movement speed constants this.PLAYER_SPEED = 150; //no gravity in top down games = 0; //keyboard cursors for input this.cursors =; }, preload: function () { //'terrain'); }, create: function () { =; this.loadLevel(); }, update: function () { }, loadLevel: function () { //create the tilemap object = this.add.tilemap(this.currentLevel); //Join the tile images to the .json data'terrains', 'terrain'); //create tile layers this.backgroundLayer ='backgroundLayer'); //this.collisionLayer ='collisionLayer'); //set background to the back of screen; //Collision Layer... if only I made it earlier //, 16, true, 'collisionLayer'); //resize the world to fit the layer //this.collisionLayer.resizeWorld(); }, gameOver: function () {'Game', true, false, this.currentLevel); } }; What do I do to fix this issue? I only have a month until my project is due!
  2. SirFizX_ELHS

    Huntin and Fishin

    This is something I put together this afternoon for my students to play with. Live demo.
  3. Hexone

    Black Screen every time.

    Hello, I have start to use phaser 3, i have setup all the basic things and follow some tutorial, but every time i use phaser 3 on my local or my web server, i have this : The code : My local file : If you can help me ^^ I thinks is just a things i don't get or something.. Thanks you.
  4. Infamous Flames

    Fire Hungry About [Fire Hungry] Fire Hungry is a friendly, fun 2d shooter io game. Play as your favourite snack and burn up others with your powerful rapid flames with a simple mouse click. Players must strive to reach the highest score! Have fun! Fire Hungry was created by Infamous Flames How to Play [Fire Hungry] Unlock a character or use the default skin. Type in a name of a choice and click the blue play button to start. Move your player around the mouse. Click to shoot. [Fire Hungry] Strategy Moving your player carefully with the mouse will make dodging fire bullets a lot easier from other players.
  5. Hi all, Could you help how i can stop detecting collision between two sprites after detecting?, this.animal, this.stopanimzwierz, null, this); After collision i have function which is stop moving sprites, but sprites still staying in collision so i am not possible to start next function which is moving those sprites. Could you help me to find solution? In simple way i want to stop sprites, stop collision between them to move it again with automatically function.
  6. Hi, I have built a mini games app in Adobe Air (in iOS and Android). It features lots of swf animations and lots of games. Now since the future of Adobe Air is circumspect. I want to hedge my bets by rebuilding the games in another platform which has a better future outlook. I had a few questions: 1) Which platform is better for building an app- OpenFL or Phaser ? I found OpenFL online which seems to be the best way to port flash games into html5. 2) Can I have a multi platform app in which suppose 100 games are there - 50 made in Phaser and 50 made in OpenFL? 3) I had read in one website that Phaser is not good for resolutions above 600x400 px. Is this true? 4) Since we want to support all resolutions in Android and iOS- we need vector graphics (the core strength of AIR). Do Phaser/CoreFL support Vector? Thanks, Nish
  7. Hemanthraj

    how to make number tiles

    How to make number tiles with colors for example: array[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]; I need to show into these box
  8. ExcitedBeginner

    Running into trouble making my first game

    Hello! I'm a total beginner (both with this forum, and Phaser), so please forgive me for any mistakes. I am trying to combine two examples I found on the website. This one, and this one. I want to pause the game when pressing the 'pause' button. I'm getting the error "Uncaught TypeError: Cannot read property 'onInputUp' of undefined" in the console. I'm using Phaser 3.2.0, and I understand that the examples I found are from an earlier version, so maybe that's why it's not working? Please help! This is my code: var config = { type: Phaser.AUTO, width: 800, height: 600, parent: 'game_2', physics: { default: 'arcade', arcade: { gravity: { y: 300 }, debug: false } }, scene: { preload: preload, create: create, update: update } }; var player; var stars; var bombs; var platforms; var cursors; var score = 0; var gameOver = false; var scoreText; var game = new Phaser.Game(config); function preload (){ this.load.image('sky', 'game_2/assets/sky.png'); this.load.image('ground', 'game_2/assets/platform.png'); this.load.image('star', 'game_2/assets/star.png'); this.load.image('bomb', 'game_2/assets/bomb.png'); this.load.spritesheet('dude', 'game_2/assets/dude.png', { frameWidth: 32, frameHeight: 48 }); } function create (){ // A simple background for our game this.add.image(400, 300, 'sky'); // The platforms group contains the ground and the 2 ledges we can jump on platforms = this.physics.add.staticGroup(); // Here we create the ground. // Scale it to fit the width of the game (the original sprite is 400x32 in size) platforms.create(400, 568, 'ground').setScale(2).refreshBody(); // Now let's create some ledges platforms.create(600, 400, 'ground'); platforms.create(50, 250, 'ground'); platforms.create(750, 220, 'ground'); // The player and its settings player = this.physics.add.sprite(100, 450, 'dude'); // Player physics properties. Give the little guy a slight bounce. player.setBounce(0.1); player.setCollideWorldBounds(true); // Our player animations, turning, walking left and walking right. this.anims.create({ key: 'left', frames: this.anims.generateFrameNumbers('dude', { start: 0, end: 3 }), frameRate: 10, repeat: -1 }); this.anims.create({ key: 'turn', frames: [ { key: 'dude', frame: 4 } ], frameRate: 20 }); this.anims.create({ key: 'right', frames: this.anims.generateFrameNumbers('dude', { start: 5, end: 8 }), frameRate: 10, repeat: -1 }); // Input Events cursors = this.input.keyboard.createCursorKeys(); // Some stars to collect, 12 in total, evenly spaced 70 pixels apart along the x axis stars ={ key: 'star', repeat: 11, setXY: { x: 12, y: 0, stepX: 70 } }); stars.children.iterate(function (child) { // Give each star a slightly different bounce child.setBounceY(Phaser.Math.FloatBetween(0.4, 0.8)); }); bombs =; // The score scoreText = this.add.text(16, 16, 'score: 0', { font: '24px Arial', fill: '#fff' }); // Collide the player and the stars with the platforms this.physics.add.collider(player, platforms); this.physics.add.collider(stars, platforms); this.physics.add.collider(bombs, platforms); // Checks to see if the player overlaps with any of the stars, if he does call the collectStar function this.physics.add.overlap(player, stars, collectStar, null, this); this.physics.add.collider(player, bombs, hitBomb, null, this); /* Code for the pause menu */ var w = 800; var h = 600; // Create a label to use as a button pause_label = this.add.text(w - 100, 20, 'Pause', { font: '24px Arial', fill: '#fff' }); pause_label.inputEnabled = true; () { // When the pause button is pressed, we pause the game game.paused = true; // Then add the menu menu = game.add.sprite(w/2, h/2, 'menu'); menu.anchor.setTo(0.5, 0.5); // And a label to illustrate which menu item was chosen choiceLabel = game.add.text(w/2, h-150, 'Click outside menu to continue', { font: '30px Arial', fill: '#fff' }); choiceLabel.anchor.setTo(0.5, 0.5); }); // Add a input listener that can help us return from being paused game.input.onDown.add(unpause, self); // And finally the method that handels the pause menu function unpause(event){ // Only act if paused if(game.paused){ // Calculate the corners of the menu var x1 = w/2 - 270/2, x2 = w/2 + 270/2, y1 = h/2 - 180/2, y2 = h/2 + 180/2; // Check if the click was inside the menu if(event.x > x1 && event.x < x2 && event.y > y1 && event.y < y2 ){ // The choicemap is an array that will help us see which item was clicked var choicemap = ['one', 'two', 'three', 'four', 'five', 'six']; // Get menu local coordinates for the click var x = event.x - x1, y = event.y - y1; // Calculate the choice var choice = Math.floor(x / 90) + 3*Math.floor(y / 90); // Display the choice choiceLabel.text = 'You chose menu item: ' + choicemap[choice]; } else{ // Remove the menu and the label menu.destroy(); choiceLabel.destroy(); // Unpause the game game.paused = false; } } } } function update (){ if (gameOver) { return; } if (cursors.left.isDown) { player.setVelocityX(-160);'left', true); } else if (cursors.right.isDown) { player.setVelocityX(160);'right', true); } else { player.setVelocityX(0);'turn'); } if (cursors.up.isDown && player.body.touching.down) { player.setVelocityY(-330); } } function collectStar (player, star){ star.disableBody(true, true); // Add and update the score score += 10; scoreText.setText('Score: ' + score); if (stars.countActive(true) === 0) { // A new batch of stars to collect stars.children.iterate(function (child) { child.enableBody(true, child.x, 0, true, true); }); var x = (player.x < 400) ? Phaser.Math.Between(400, 800) : Phaser.Math.Between(0, 400); var bomb = bombs.create(x, 16, 'bomb'); bomb.setBounce(1); bomb.setCollideWorldBounds(true); bomb.setVelocity(Phaser.Math.Between(-200, 200), 20); bomb.allowGravity = false; } } function hitBomb (player, bomb){ this.physics.pause(); player.setTint(0xff0000);'turn'); gameOver = true; }
  9. newbie11

    How to add a text value

    Hi! can anyone tell me how to put some value on my "score" i already use if (playState.score <= 3){ game.add.text(20, 20, "practice more",{font: '50px Sports World', fill: '#b7e2fe'}); but it doenst work var winState = { create: function () { game.add.tileSprite( 0, 0, 1000, 490, "background3") if (playState.score >= loadState.hiscore) { loadState.hiscore = playState.score; } var hiscoreLabel = game.add.text(473, 155, loadState.hiscore, {font: '50px Sports World', fill: '#fdf59e'}); var scoreLabel = game.add.text(473, 243, playState.score, {font: '50px Sports World', fill: '#b7e2fe'});; var spaceKey = game.input.keyboard.addKey(Phaser.Keyboard.SPACEBAR); spaceKey.onDown.addOnce (this.restart, this); var escKey = game.input.keyboard.addKey(Phaser.Keyboard.ESC) escKey.onDown.addOnce (this.menus, this); }, restart: function (){ game.state.start('play'); }, menus: function (){ game.state.start('menu'); }, } thats my code pls help me thank you!
  10. Hi there. Does anyone had a pleasure to build a Facebook Instant Game? I've spent two days trying to scale my Phaser game in the Facebook for Android. Currently scaling works nicely on desktop, in a responsive viewport of the dev console, in the mobile Chrome -- namely everywhere, except the Facebook app. Seems like it just ignores my settings, sprites are displayed at full width, despite the canvas (and game) dimensions are correct. Here are my init and boot scripts, the scaling logic is copypasted from a random gist: // init code FBInstant.initializeAsync().then(function() { FBInstant.setLoadingProgress(50); FBInstant.setLoadingProgress(100); FBInstant.startGameAsync().then(function() { /** Config part */ var FIXED_SIZE = 720; var FIXED_MEASURE = 'Width'; /** Name mapping */ var fixedName = FIXED_MEASURE; var resName = fixedName === 'Height' ? 'Width' : 'Height'; var FIXED_NAME = fixedName.toUpperCase(); var RES_NAME = resName.toUpperCase(); /** Measures of document */ var documentElement = document.documentElement; var documentFixed = window['inner' + fixedName]; var documentRes = window['inner' + resName]; var ratio = documentRes / documentFixed; /** Canvas measures */ var canvasFixed = FIXED_SIZE; var canvasRes = FIXED_SIZE * ratio; var screen = {}; screen['CANVAS_' + FIXED_NAME] = canvasFixed; screen['CANVAS_' + RES_NAME] = canvasRes; console.log(screen.CANVAS_WIDTH); console.log(screen.CANVAS_HEIGHT); game = new Phaser.Game(screen.CANVAS_WIDTH, screen.CANVAS_HEIGHT, Phaser.CANVAS); game.state.add('Boot', Boot); game.state.add('Preload', Preload); game.state.add('GameTitle', GameTitle); game.state.add('Main', Main); game.state.add('GameOver', GameOver); //Start the first state game.state.start('Boot'); }); }); // boot code var Boot = function(game) {}; Boot.prototype = { preload: function() { }, create: function() { this.scale.scaleMode = Phaser.ScaleManager.EXACT_FIT; this.scale.pageAlignHorizontally = true; this.scale.pageAlignVertically = true;;"Preload"); } } Would appreciate any help!
  11. altruist

    Issue with physics

    Hello everyone, I have the same problem like in this topic I don't understand how to set P2 Physic mode or solve this problem in other way. Please help.
  12. Thunderfist

    Map not appearing

    My game isn't loading the map I made using tiled. The file, testroom1.json, is called properly, but something in my game.js is keeping the game from loading the map itself. var RPG = RPG || {}; RPG.GameState = { init: function (currentLevel) { //Needed to keep track of the level this.currentLevel = currentLevel || currentLevel === 'testroom1'; //movement speed constants this.PLAYER_SPEED = 90; //no gravity in top down games = 0; //keyboard cursors for input this.cursors =; }, create: function () { this.Game.onscreenControls =; this.loadLevel(); }, update: function () { }, loadLevel: function () { //create the tilemap object = this.add.tilemap(this.currentLevel); //Join the tile images to the .json data'tileset', 'tilesheet'); //create tile layers this.backgroundLayer ='backgroundLayer'); //this.collisionLayer ='collisionLayer'); //set background to the back of screen; //Collision Layer... if only I made it earlier //, 16, true, 'collisionLayer'); //resize the world to fit the layer //this.collisionLayer.resizeWorld(); }, gameOver: function () {'Game', true, false, this.currentLevel); } }; I never made the collision layer. I plan on doing that AFTER getting the map to appear first. Does anyone have any advice on how to tackle this?
  13. newbie11

    how to loop

    how can i loop my background and make it like it move going to left??? thank you!
  14. Hemanthraj

    how to load custom font

    How to load custom font i need to use daft lowercase font instead of down below, var tiles =, this.tileHeight); tiles.ctx.font = '30px Arial';
  15. Hey folks, New version of Phaser CLI is here: Phaser CLI is based on the latest versions of Create React App and vue-cli, and is designed to provide a zero-config setup for your Phaser projects. Getting started: npm install -g @phaser-cli/cli # or yarn global add @phaser-cli/cli phaser create my-project cd my-project npm start # serves your project at localhost:8080 npm run build # builds for production Currently implemented: Basic template with Babel support Linting with Standard Webpack 4 Webpack Dev Server Ability to eject from Phaser CLI Coming soon™️: Support for additional templates (e.g TypeScript, CoffeeScript) Support for multiplayer games via More linting options (e.g ESLint, ESLint + Standard, ESLint + AirBnB) Add some tests into the templates Integrate Travis/AppVeyor for automated testing/deployment of Phaser CLI And likely a few other things yet to be decided. Phaser CLI is still a work in progress (read: bugs!) so please yell if you're having any issues. Any contributions to the code and other suggestions are very much appreciated 🙂
  16. real2412

    Kid Rat, Game platform clasic

    Hi guys, I share a litle game that I did in my free time the link is the following: I also converted it into apk with cordova, although it is a version in Spanish and I have no idea how to remove the cordova icon. In case you want to see it look for it in google play as "KidRat". It is open source you can check it in the following link: Greetings.
  17. I'm trying to create platforms for my player to jump onto and also make collectible stars. I can create these sprites using functions, but I don't know how to make physics work on them so that the character can jump on the platforms and overlap with the stars. The problem is that the physics portion doesn't work when I call it in the update function. I am also not using tilesprites, so it can't work that way. create: function() { addStar(star1); }, update: function() { removeStar(star1); } addStar(name) { name = game.add.sprite(1700, 550, 'star'); name.anchor.setTo(0.5, 0.5);, Phaser.Physics.ARCADE); name.body.collideWorldBounds = false; name.enableBody = true; name.body.immovable = true; } removeStar(name) { if (game.physics.arcade.overlap(character, name) == true) { name.destroy(); updateScore(); } }
  18. I'm trying to build a real-time MMO game. I'm using Phaser for FE and Node.js + for BE. I have read all the tutorials like and so on. Different players might have different FPS, this is how I update position on the client (phaser): const data = { down: this.cursors.down.isDown, timestamp: }; var deltaTime = (data.timestamp - this.lastTimestamp) / 1000; if (data.down) { player.position.y += speed * deltaTime; socket.emit('input', data); } This ensures speed is FPS independent (every player is moving with the same speed). The server is running a tick() at 60 FPS. This method is processing saved inputs from players. How should the server correct player positions? It doesn't know their delta times. It also can't use server's delta time since it would be always around 0.016 and it doesn't reflect player's update interval. tick() { var now =; var serverDelta = (now - this.prevTimestamp) / 1000; this.prevTimestamp = now; for (var player of players) { player.update(); } } player.update() { for (input in savedInputs) { player.y += input.down * speed; } }
  19. Hemanthraj

    how to make bingo game using phaser

    Hello everyone Im new to phaser, i need to make bingo game So please share your knowledge.
  20. rafaeldelboni

    Phaser3 Es6 Webpack4 Boilerplate

    Hi guys I spent some time creating a small boilerplate to use the new Phaser 3 with ES6 and Webpack 4. Plain webpack 4 Boilerplate with Babel, SASS and Phaser3 on board Some cool features: webpack 4, chunks and minifies; webpack-dev-server, development server that provides live reloading and fast in-memory access to assets; @babel/core and @babel/preset-env; eslint; updated, tried to use the latest version of everything (until this post ). I hope it helps, any sugestions, feedbacks or pull requests would be amazing!
  21. maninduw

    Using Phaser for FB Instant Games

    Hi, I am planning to develop a game for Facebook Instant Games platform using Phaser. Should I choose Phaser 3? or should I continue with Phaser 2 ? Is there a huge difference in the APIs of both version? . I would highly appreciate your opinion on this. Best Regards
  22. Barak Inbal

    Create Simple Multiplayer

    Hey I want to create a simple Tic Toe Multiplayer Mobile game using phaser 2. The game need to support the following modes: Multiplayer between 2 anonymous players Multiplayer between 2 google account players Multiplayer between 2 facebook account players I have the following questions: How can I implement this? using websockets or pooling? Do I have to use inroder to implement websocket communication between 2 mobile players? Which other libraries do I can use for creating moblie multiplayers between 2 players? Thanks in advance Barak Inbal
  23. As the opportunity to submit an HTML5 game to instant games is open now, I want to convert some of my most interesting HTML5 games to be played in messener. Facebook published a very good sample, I wonder, is there Phaser 3 or Phaser 2 specific instant game sample?
  24. MrBalling

    Mr. Balling

    Hi Everyone, I just released a game made with Phaser 2 called Mr. Balling. Used cordova to deploy it to Android and iOS. It is a simple arcade game that is supposed to be a throwback/retro arcade game. You bounce around on the screen and when you hit a ball you orbit it, once you tap on the screen you fly off. The objective is to stay alive in the middle of the screen bouncing from ball to ball, while avoiding red balls and the left and right sides of the screen. Feel free to leave feedback or thoughts about the game, I'm new to game development, but hope to keep doing it. Apple iOS App Store: Android Google Play Store: More info on the game. I came up with this idea about 10 years ago and had actually made working copies in python a few times, using pygame and kivy, but once I got into phaser I fell in love, it was super easy to get stuff working right away. As mentioned I packaged it up with cordova. I'm a Mechanical Engineer, not a software engineer, so sites like this were instrumental in figuring out how to get phaser to do what I wanted it to do. I used Piskelapp to do all of the assets. I used beepbox to make the music. It was fun having do figure out everything that goes into releasing something like this. Obviously as you can see it is a pretty simple premise for a game. However, I plan to make a sequel extending the game mechanic more. Also tried to make a pseudo dev-log, still under construction, but you can find more info at Screenshots of the game, title screen and several screenshots during the game as well as gameover screen. I did high score tracking using firebase.

    [Phaser] Mondo Hop

    Introducing Mondo Hop, a bouncing side-scrolling platformer. Please try it out. GAME FEATURES: Addictive quick-paced gameplay, beautiful 3d modeled graphics, original sounds and music, and smooth performance on both mobile and desktop. TO PLAY: Use the bottom on-screen buttons or the arrow keys to move. Bounce from platform to platform (some of which are moving) without falling. Jump on the springs for a boost. Make it to the end before time runs out and try to collect all the coins along the way. There are 64 progressively harder levels in all. PLAY AT: All feedback is welcome. Developed with Phaser.