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
    • Facebook Instant Games
    • 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,361 results

  1. KevinnFtw

    Phaser one-sided overlap detection?

    Hi guys, At the moment I'm having some issues detecting which sprite is overlapping another sprite. The overlap function works fine, but I would like to know which of the 2 sprites goes over the other sprite. I only want to execute a certain function if sprite A walks over sprite B, and not if sprite B walks over sprite A. Is there any way I could check this inside of the overlap function? Thanks, Kevin
  2. I have a question about the tweening system in Phaser. If I perform a complex animation with multiple sprites (or a simple animation involving only 1 sprite but with scale and alpha) I have to write something like this: this.halo.scale = {x:0, y:0}; this.halo.alpha = 1; if (this.halo.scaleTween) { this.halo.scaleTween.stop(); } if (this.halo.alphaTween) { this.halo.alphaTween.stop(); this.halo.alphaTween = null; } this.halo.scaleTween = game.add.tween(this.halo.scale) this.halo.scaleTween .to({x:1, y:1}, 1000, Phaser.Easing.Bounce.Out) .start() .onComplete.addOnce(function() { this.halo.alphaTween = game.add.tween(this.halo).to({alpha:0}, 1000).start(); }, this);When I'd rather write something like this:game.stop.tween("halo bounce"); // No error if not foundgame.add.tween("halo bounce") .then(this.halo.scale, {x:1, y:1}, 1000, Phaser.Easing.Bounce.Out) .then(this.halo, {alpha:0}, 1000) .start();Is this sort of system possible at all? Am I using the existing Phaser API wrong? Additionally, in our C++ engine, we had an 'also' function as well. This would allow you to add new tweens in the dot chain, but they got added at the same point as the previous one:game.add.tween("game over") // The name is optional. Anonymous tweens are the default .then(1000) // Delay before starting .then(, {alpha:1}, 100) .also(, {x:1, y:1}, 100) // This one runs ALONGSIDE the 'alpha' tween .then(function() { this.openScoreScreen(this.stats); }, this); // This one runs at the END of the 'scale' tweenIf this system looks exciting (I think it is, we've shipped a lot of triple-A casual games on all platforms (except HTML5) with it...) I would be happy to work together to add it to Phaser. Luc Bloom
  3. I am a newbie to game dev and Phaser. My scenario is this. I have a rectangular sprite(Initial angle 0 degrees) that rotates about its base. There is another rectangular sprite below it which gets overlapped by the rotating sprite at each rotation. Collision without rotation works for me. But I am unable to detect the collision when the first sprite rotates. Please help me sort this issue. I use arcade physics. My code is below. function create() { sprite1 = game.add.sprite(100, 100, "sprite1"); sprite1 = game.add.sprite(100, 150, "sprite1"); game.physics.enable(sprite1, Phaser.Physics.ARCADE); game.physics.enable(sprite2, Phaser.Physics.ARCADE); }function update() { sprite1.angle += 1; game.physics.arcade.collide(sprite1, sprite2, collisionHandler, null, this);}function collisionHandler(obj1, obj2){ console.log("Collided");}
  4. lobsterhands

    Player Slide When Changing Directions

    I'm trying to get my player controls to be more responsive. Currently, when I stop inputting directions, the player stops quickly. However, if I try to change directions quickly, switching immediately from left-to-right (or vice versa) my player slides a bit in the original direction. How can I fix this? See the game here: Controller code below: *Note playerHigh and playerLow describe the player's coordinates as near the top or the bottom of the rectangle. onLeft and onRight describe whether the player is touching the side of the rectangle. function leftInputIsActive() { var isActive = false; isActive =; isActive |= ( && <; return isActive; } function rightInputIsActive() { var isActive = false; isActive =; isActive |= ( && > +; return isActive; } if (rightInputIsActive() && !playerLow) { this.player.body.acceleration.x = this.ACCELERATION; } else if (rightInputIsActive() && playerLow) { this.player.body.acceleration.x = -this.ACCELERATION; } else if (leftInputIsActive() && !playerLow) { this.player.body.acceleration.x = -this.ACCELERATION; } else if (leftInputIsActive() && playerLow) { this.player.body.acceleration.x = this.ACCELERATION; // } else if (leftInputIsActive()) { // this.player.body.acceleration.y = this.ACCELERATION; // } else if (rightInputIsActive()) { // this.player.body.acceleration.y = -this.ACCELERATION; } else if (leftInputIsActive()) { this.player.body.acceleration.y = this.ACCELERATION; } else if (rightInputIsActive()) { this.player.body.acceleration.y = -this.ACCELERATION; } else { this.player.body.acceleration.x = 0; } if ((leftInputIsActive() && onLeft) || (rightInputIsActive() && onRight)) { this.player.body.acceleration.y = this.ACCELERATION; } else if ((leftInputIsActive() && onRight) || (rightInputIsActive() && onLeft)) { this.player.body.acceleration.y = -this.ACCELERATION; } else { this.player.body.acceleration.y = 0; }
  5. Hi. I have a big problem with my Phaser project. I use Phaser + Typescript. I use this tutorial: If I use the following code, I get this error: "Uncaught TypeError: Cannot set property 'gravity' of null" class FlappyBirdsGame { game: Phaser.Game; bird; constructor(renderDiv: String) { = new Phaser.Game(400, 490, Phaser.AUTO, renderDiv, { preload: this.preload, create: this.create, update: this.update });'main', this); } preload() { = '#71c5cf';'bird', 'assets/bird.png'); } create() { this.bird =, 245, 'bird'); this.bird.body.gravity = 1000; var spaceKey =; spaceKey.onDown.add(this.jump, this); } update() { if (this.bird.inWorld == false) { this.restartGame(); } } jump() { this.bird.body.velocity.y = -350; } restartGame() {'main'); }}window.onload = () => { var game = new FlappyBirdsGame('content');}What is the problem? If I run this code, the "bird" is displayed. You can see the source also on git: Thank you
  6. BigiBigi The Guardian BigiBigi is in charge of keeping the cheese safe from the mice. You have to help BigiBigi in its mission of aborting the mice's attack and keeping safe Uncle Ben's cheese. Play BigiBigi The Guardian We hope you will enjoy playing our game. Any mobile test, feedback or suggestion is welcomed
  7. KevinnFtw

    Invisible sprites ignore collision

    Hey guys, In my game I hide some sprites by setting their visible setting to false. Problem is, my collision detection still detects if these invisible sprites are getting hit. I would like to know how I can make the collision detection ignore them. Recently I've seen a option on these forums which was something like sprite.collision = false. I think it was an option to ignore the collision of a certain sprite. Too bad I can't find that post or option anymore, so that's why I'm making a new post about it. Hope anyone can help me, otherwise I'll have to write my own detection for just visible sprites but enabling some kind of option would be much easier. Thanks, Kevin
  8. I (@DrSeanWalton) have been working on a space simulation game with my brother in law Barry (@Half_Hit_Points). The game has realistic gravitational effects i.e. the gravity in the solar systems you explore are fully modelled, asteroids orbit planets which orbit the sun. This (we hope) makes things interesting but tricky, so I'd love some feedback on the controls. I have implemented gamepad support using phaser but a recent chrome update stopped it working, I will be adding it back in the future, for now it's keyboard. It works best in chrome. You can play the game here More information can be found on my blog here and Barry's blog here
  9. atlantageek

    lost game state

    All, I'm having some trouble with my game over state and not sure why. It just shows a blank screen. I can go from the menu directly to the game over state just fine but from the play state to the game over state it fails. Here is the link to the game Takes a little while to load. Any suggestions would be appreciated.
  10. Hello! I was wondering if there are any nifty ways to mute SFX and music separately? This can be achieved with Web Audio API easily by using separate gainNodes for each type of sounds, but I'd rather have a more compatible solution. Apparently Rich is working on an overhaul of the sound system in Phaser, but does the overhaul possibly cover audio grouping? -V
  11. JustABeginner

    Phaser features

    Hi. I'm actually new to HTML gaming, but I definitely see the potential. The thing is - until now, I've mostly used Java (libGDX framework) and, well, networking might be an issue if you want to (for example) use GWT. So, before I start digging into Phaser and JavaScript, I'd like to ask two questions: 1. Does this framework provide a networking API that would actually work on all browsers and isn't horribly complicated? Classic server-clients structure is fine for me. 2. Does it have a GUI API, preferably one that supports ninepatches? Sorry for wasting your time, take care. ; )
  12. Hi, well this is the first time I share something with u. Recently I started to learn to play the guitar and I needed a tuner... so i made mine. Why? Why not? I know well it's not the best one out there, but, would you tell me what do you think? P.S. If I wrote something wrong please tell me.
  13. I started working on a simple game series wherein I am trying to finish every game listed in the books I've read about game dev. Currently I am working through the Invent With Python series. I am already done with 2 of the games - Matching Pairs and Sliding Puzzle, Here's the third in the series - Follow Me - a Simon Clone. All the code and art is completely open, keeping with the series' motives. Share, fork, contribute, comment!
  14. So i'm at a hackathon (btw quick responses appreciated because of this fact (´・ω・`) ) and my friend and i are dealing with a players die and respawn often. we know that when we want to add a sprite to the game from within a class that extends Phaser.Sprite we have to run the code: super(, x, y, ResKeys.player2Sprit);; //<-----this is the line im referring toso we want to know if theres an opposite to where we can remove the sprite from game existence without killing the class, put it back into that state of limbo between the super() and add() calls.
  15. Hi, UPDATE: web url: I would like to ask your help with a hobby project. It's packed with CocoonJS for Google Play. If you have some time and you have an android phone then please provide the following information: 1. FPS in the main menu 2. FPS in the game on level 1 3. Your phone brand ( if you know the memory,cpu,gpu ) and the android version. 4. Any tips or suggestions concerning the gameplay. The fps can be seen on the left side with white numbers. If you have really low fps try to turn off sounds,music and set graphics to Low from the settings. The game can be downloaded from goole play: Level Editor: Anybody who wants to create a level can download the template and if its good it will make it into the final game(along with the creator's name). Gameplay video: Web: http://cubimal.baldricksoft.comEditor: Thank You! Viktor
  16. I'm working on prototyping a game that will allow a player to walk all the way around a sprite (think of it as a planet, despite it being a rectangle). Please view the very simple idea here: Instead of the player falling off the side of the "planet" and landing on the ground below, I want him to be able to walk all the way around the rectangle. Is this possible using Arcade physics? Basically, I want to set the rectangle sprite to have its own gravity. Also, I'd like to eventually add another "planet" which has its own gravity. Any ideas? Would I have to use a circle instead?
  17. KevinnFtw

    Group CreateMultiple infinite?

    Hi, I'm creating a shooter game, and I've followed the 'Space Invaders' example. Everything is working but one thing, I would like to have infinite ammo, so CreateMultiple has to be infinite. It requires a value, so I don't know how to make it actually infinite. Basically what I want to do is create a couple bullets and recycle them over and over again. Any suggestions on how I could do so you never run out of bullets? Thanks in advance, Kevin
  18. Noaml1

    How do angles work in phaser?

    I'm testing some things out with the phaser framework and one thing i can't figure out is angles. I'm currently trying to make a sword (see attached picture) go from upright to horizontal once it falls to the floor using angularAcceleration. First im trying to play with the angles themselves and understand how it works but no matter what i set the .angle equal to it, the picture stays the same orientation
  19. Could you help me out with a problem that I have with the game im making. Between the menu and game state (witch has a button that sends me to the gam menu) and game state with tilemap (in witch if you press the enter key it sends me back to the menu). My problem consists in the fact that when I press the enter key in the game state to go back to the menu, the menu button disappears, I've tried to do it from the menu with a game state without tilemap and the button doesn't disappear. As a possible solution Ive thought about if while pressing the enter key apart from redirecting the user to the menu, it destroys the map with the method destroy(), which supposedly eliminates the map and its corresponding layers. As a conclusion, I think that the object map ends up getting deleted, but not its layers. Game Link: Github Assets Link:
  20. ivanix

    [WIP] [Phaser] SushiDoku!

    A Sudoku puzzle game using sushi tiles in an isometric view. Notes: The basic goal is to fill the 9x9 board with sushi tiles by first highlighting the desired sushi tile on the top black board and then selecting the destination on the board. Each type of sushi must fit one and only one time on each row and column along with only once in each 3x3 section similar to the Sudoku rules using numbers. - The 'How to Play' button is not functional. Sorry. Much obliged any feedback especially from mobile phone and tablet users. Cheers
  21. i'm trying to follow the starstruck example in remake it in typescript and im getting an error i dont understand. This is what i have so far : create() {; = '#000000'; =, 0, 800, 600, 'background'); = true; ='level1');'tiles-1');[13, 14, 15, 16, 46, 47, 48, 49, 50, 51]); this.layer ='Tile Layer 1'); this.layer.resizeWorld(); = 250; this.player =, 32, 'dude');, Phaser.Physics.ARCADE); this.player.body.bounc.y = 0.2; this.player.body.collideWorldBounds = true; this.player.body.setSize(20, 32, 5, 16); this.player.animations.add('left', [0, 1, 2, 3], 10, true); this.player.animations.add('turn', [4], 20, true); this.player.animations.add('right', [5, 6, 7, 8], 10, true);; this.cursors =; this.jumpbutton =; } update() {, this.layer); this.player.body.velocity.x = 0; if (this.cursors.right.isDown) { this.player.body.velocity.x = 150;'right'); } }everythings been loaded correctly in the preload method and im getting the error: Phaser v2.0.5 - Canvas - WebAudio ♥♥♥ phaser.js:19908Uncaught TypeError: Cannot set property 'y' of undefined Main.ts:39Uncaught TypeError: Cannot read property 'right' of undefined Main.ts:58 the first error occurs in this area:, Phaser.Physics.ARCADE); this.player.body.bounc.y = 0.2;the second here: this.player.body.velocity.x = 0; if (this.cursors.right.isDown) {what's happening?
  22. Hello all. I've been trying to create a simple line drawing 'game' using a bitmapData object and the CanvasRenderingContext2d object it contains. I've been successful, but it wouldn't support drawing two seperate line segments, preferring instead to make a line from the endpoint of the last line to the starting place of the new one. I wrote up some new code to try to fix that, (and I am probably missing something very obvious) but it does not work. No error is thrown, but nothing shows up onscreen. update: function() { if( && ! { if(!this.hasMoved) { this.ctx.moveTo(,; this.hasMoved=true; } else { this.ctx.lineTo(,; this.ctx.stroke(); } } if( this.hasMoved=false; }
  23. facetiousfactorial.cs

    How to Remove Rough Edges from Sprites

    I know this is probably well known, but I don't know the name for it and no amount of googling could help me find the answer. (Maybe I wasn't googling hard enough.) How do you remove the rough edges from pictures? I mean, how can I show the part of the picture I want to show and remove the whitespace, having the background overlay it.? I'm not using any spritesheets.