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. How to identify button click from array of buttons?
  2. nduhu

    [ASK][PASHER]bounce sprite

    how i can make image bounce in center place? var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render }); function preload() { game.load.image('flyer', 'assets/sprites/phaser-dude.png'); } var image; function create() { game.physics.startSystem(Phaser.Physics.ARCADE); image = game.add.sprite(0, 0, 'flyer'); game.physics.enable(image, Phaser.Physics.ARCADE); image.body.velocity.setTo(200,200); image.body.collideWorldBounds = true; image.body.bounce.set(1); } function update () { } function render () { game.debug.spriteInfo(image,32,32); }
  3. instantia

    Water. Slowdown in P2 physic

    How do I desired deceleration of the object in motion? Suppose when the object is in the water acts on it slowing. I tried to do velocity * 0.99. Slowing down there, but got out a lot of bugs. Now do so:this.obj.rotation = game.physics.arcade.moveToXY(this.obj, this.pointer.x, this.pointer.y, this.speed, 200);How do I make braking object? I've already rummaged
  4. Hey guys jg here, So I recently stumbled across PhaserJS and found some cool youtube tutorial videos and documentation online. I've managed to display my sprite on the canvas. I wanted to get it to drop down so I set the sprites velocity.y = 100; But it's not moving. Can someone tell me what's wrong with my code? var star;var game = new Phaser.Game(800, 600, Phaser.AUTO, '', { preload: preload, create: create, update: update });function preload(){ game.load.image('star','star.jpg'); } function create(){ star = game.add.sprite(,0,'star'); star.velocity.y = 100; } function update(){ }
  5. Edricus

    Performance Tips

    Hello everyone. This is my first time posting on the HTML5 Game Dev forums so don't hurt me. I am currently working on a small project for a job that I got about a month ago. We are using the Phaser engine to create three games in one app. Two of the games use Phaser's Arcade Physics the third does not. We wanted these games to be available on both the App Store (iOS) and the Play Store (Android) so we decided to go with PhoneGap to wrap our games. Our first few attempts were with CocoonJS and that didn't work out too well for us. So in short, right now we are at the stage where we can get PhoneGap to give us a working app that we can put on an Android phone for testing. We have tested our app with three different phones right now ranging from old, to decent to pretty much brand new. The phones are as follow: HTC Desire C HTC One V Samsung Galaxy S4 MiniThe games run fine on the S4 Mini with a couple blips in the frame rate here and there but on the other two devices they just run horribly. Unfortunately we haven't had the opportunity to test on other physical devices just yet. Through some research we saw some posts stating that devices pre-2012 don't run JavaScript that well. This would explain the first two devices but not so much about why there are frame rate blips on the S4 Mini. I realize the easiest thing to look at is how the code is written but we ran a test app on its own on the first two phones. This app simply has a tween that goes off once every 6 seconds tweening in 6 colored boxes. The only other thing is there is an event listener for a tap on the boxes. If anyone can shed some light on the issue, that would be greatly appreciated!
  6. i want to disable button after clicking to prevent double-click and enabled again after specific time ? how i can do it ?
  7. I want to touch a sprite hold it and drag it to a new point and then release it. How do I implement this? I tried the following code. sprite.inputEnabled = true;sprite.input.start(0, true);sprite.input.enableDrag(false, true, true);It is working perfectly using mouse on desktop but on mobile, first i have to touch the sprite then touch on another position to move the sprite there(No dragging and dropping is done here). I want to touch the sprite to pick it up and without releasing I want to drag and move it to a new position. Please help. Thanks
  8. IamStuck

    Game won't load (newbie)

    Hi, I recently decided to have a go at making a game (a very simple one) and have run into an error and I am now unsure what to do. I'm using version 2.0.5 and the error I get is 'TypeError: h is undefined' (In firebug it says the error is coming from phaser.min.js) My game is split into states (load, game, menu, level) I've pasted my level code into JSFiddle Thank you for any help and if you need more info then I'll provide it.
  9. Hi everybody, Here's my problem. I have a group, which I scale or rotate. Now if I drag a sprite in it, the sprite moves totally wrong. Its shift is scaled and rotated too! var gr = ;var sp = gr.create( 100, 100, 'face' ) ;gr.scale.x = -2 ;sp.enableInput = true ;sp.input.enableDrag( true ) ; Say, if the group is flipped by group.scale.x = -1, the sprite motion will be mirrored: the sprite and the cursor go different directions. Looks more like a bug of dragging. I'd appreciate any practical advice or workarounds. I have a big tree of nested groups, do I need to implement a multistage cast of the input coordinates? Thank you.
  10. end3r

    Monster Wants Candy

    I'm happy to announce that I've finished my third game (after Captain Rogers and Craigen) with Robert from Blackmoon Design and it's called Monster Wants Candy. It's a simple, casual mobile HTML5 game where you have to collect the candy to save your love from evil King. You can PLAY THE GAME HERE. The source code of the demo is available on GitHub, you can also read short "making of" post on the blog. The demo of this game was shown at Mozilla Festival 2013 and the Phaser tutorial I'm working on for a few months now is based on that demo. I'd love to get any feedback on the game itself and testing on various mobile devices as I own only a few. If you find bugs or have improvements, please let me know in the comments, thanks! Edit: The Getting Started With Phaser: Building "Monster Wants Candy" tutorial is finally available at Tuts+ Gamedev.
  11. Hi! I have researched how to integrate the Google Play Games with our javascript games, and found nothing. Any of you have a idea how to do it? P.S.: After I see the CocoonJS demo, I see that is possible, but, how to do it?
  12. benjamin

    debug p2js physics

    when i switch to p2js I can't seem to debug physics at all (I dont see any overlays). So here is what i am doing oncreate this.pandas =, 'pandas', false, true, Phaser.Physics.P2JS); this.pandas.createMultiple(28, 'panda');onupdate at certain intervals I fetch a panda! var panda = this.pandas.getFirstExists(false); if (!panda) { return; }...panda.reset(x, y);panda.debug = true;render this.pandas.forEachAlive(function(panda) { game.debug.body(panda); });
  13. benjamin

    [closed]phaser lock body axis

    Is there a simple way to lock the x or y axis of a p2js body? I ask because I need to keep a group of objects within columns, I'm hoping I can avoid creating new column-gutter sprites just to separate the columns.
  14. So i'm trying to crop an image and it isnt working - i keep getting Uncaught Error: Texture Error: frame does not fit inside the base Texture dimensions [object Object] But this isnt making sense to me because this is how making the rectangle: var currentHeart: Phaser.Image = this.heartFills[i][this.heartFills[i].length - 1]; this.cropRects[i] = new Phaser.Rectangle(currentHeart.x,currentHeart.y, currentHeart.width-10,currentHeart.height-10); currentHeart.crop(this.cropRects[i]); currentHeart.position.y = 56 - currentHeart.height;Literally telling it "just go 10 pixels smaller than the image itself in both directions". My end goal is to the x be currentHeart.x and my y be a fraction of the height based on the players health, but right now I can;t get it to crop and i dont understand why.
  15. Noaml1

    Following Multiple Sprites

    A friend and I are working on a platformer-fighting game using the Phaser framework and are wondering if there is anyway built in function to keep multiple sprites on the screen at the same time? We want it so that we can zoom in to the players if they are all next to each other but for the camera to zoom out if they separate (kinda like super smash bros melee).
  16. Hey guys, I'm having some issues switching between states. In the first run it all works fine, but then when I come back to a state I've already been at, like MainMenu, the design is all messed up. I think it is because not all sprites and stuff are removed when I switch states, that's why I added a in my shutdown function. However that doesn't seem to do anything. Is there another short way to delete everything (except cache) from a state before switching to another state, or does it have to be done manually? I've attached 2 images, one of my MainMenu first time, and one of the MainMenu when I switch back to it (after the Game). Excuse me if it is a silly question, I've just recently started using states.. Thanks, Kevin
  17. Hello, The loadPolygon method doesnt change when the shape of animation changes. var ship = game.add.sprite(200, 200, 'player'); ship.animations.add('fly', [0,1,2,3], 10, true);'fly'); game.physics.p2.enable(ship, true); ship.body.clearShapes(); ship.body.loadPolygon('physicsData', 'suu'); ship.body.fixedRotation = true; The loadPolygon is the same. How can i change the shape and the loadPolygon the same time?
  18. Hi everybody ! Here is the 2nd game I made with Phaser : Candy Mirror Ninja ! The originality is that you don't see things as they are, you only see the images of them on mirrors which are the walls of the levels. You will need some time to get used to it, it's a bit special to master. Controls : Use the arrows to move the Ninja and the mouse to aim and shoot when you get the Laser. Information : The game is based on the themes of the Global Game Jam 2014 ("We don't see things as they are, we see them as we are") and the Candy Jam.It's why there is a King which protects the Candy from you. He shoots avocados (because the french for avocado is also the name for lawyer, little joke ^^) in each direction, faster if you get closer to the Candy. These avocados can kill you.Finally, you can get a Laser to shoot at the King or mirrors to make reflections. Notes : The game uses masks for the mirror images, so it requires WebGL.The game doesn't work on Internet Explorer.Firefox doesn't render well the texts.You need to activate WebGL in Safari.Chrome is the best browser for this game. >> The link of the game on : << >> The source on GitHub : << Hope you have fun even if it's a little difficult and a bit ugly ^^ Let me know what you think of it !
  19. Hi, I'm making a simple game with Phaser I have a spritesheet with two frames. I need an animation of sprite disappear, frame change and appear again like .to( {x:0, y:0 }, 600, Phaser.Easing.Bounce.Out); .frame = 1; .to( {x:1, y:1 }, 600, Phaser.Easing.Bounce.Out); How do i connect it into one chain? Thanks,
  20. I have a scene where blocks fall from the sky onto the ground. As they do, they stack up thanks to collision separation. I noticed however that after the stack reaches a height of two or three blocks the incoming block somehow forces blocks at the bottom to lose their separation. I want to stop that from happening. If two blocks collide they should remain separated. I am using the arcade physics, (hope that's not the problem). here is the code window.onload = function() { 'use strict'; var state = { lastCheckin: 0, pandas: null, preload: function () { game.load.image('panda', 'assets/panda.png'); }, loadUpdate: function () { }, loadRender: function () { }, create: function () { game.physics.startSystem(Phaser.Physics.ARCADE); this.pandas =; }, update: function () { game.physics.arcade.collide(this.pandas, this.pandas); var now =, delta = now - this.lastCheckin; if (delta > 1000) { this.lastCheckin = now; var panda = game.add.sprite(Math.random() *, 0, 'panda'); this.pandas.add(panda); game.physics.arcade.enable(panda); panda.body.gravity.y = 500; panda.body.collideWorldBounds = true; } }, render: function () { }, paused: function () { }, pauseUpdate: function () { }, shutdown: function () { } } var game = new Phaser.Game(320, 480, null, null, state);};
  21. sudolim

    LeapJS with Phaser?

    Newbie here. Making a game/installation with phaser and was wondering if I can use leapjs with phaser? Any advice would be appreciated. Thanks! JW
  22. Hi guys, Maybe a silly question, but I recently started using States in my game and now I am converting my functions to work with states. The functions without parameters work fine, but the ones with parameters don't. For example, when I call: this.createBullet(x, y); I get the error: Uncaught typeError: undefined is not a function. The function createBullet(x, y) does exist, it is created like this: createBullet: function(x, y) { // blablabla content of function } p.s. these functions are in my Game.js state Can anyone tell me what I'm doing wrong? It has to be a silly mistake but I don't know how to fix it Thanks, Kevin
  23. Hello there! This is my first game with the Phaser framework, also the first game i released in public. I'm trying to work with the mindset of . The reason is that i always try to make games, spending all my time changing and adding new things and the result was me being bored with the game and never completing it. Now, i was "forced" to finish the game and it worked much better than before! I know this is a bad game, not much content, bad art, But hey! I'm still learning! The game is a simple space shooter (What an awesome game title! Right? ) Your ship follows the mouse pointer and shoots automatically when an enemy is seen. Take the " ? " boxes for power ups! You can upgrade your weapon in the shop with the credits you earn each fight! Stay alive long enough to fight the boss! You can play it here: You can find the source code here: Any comment,suggestion, improvement or bug report is welcome!
  24. Fiero_MF

    Animated particles

    Hi, I'm trying to get an explosion working with animated particles in Phaser. So far I've got the emitted working fine and seem to be able to add animations to the particles, but running these animations does nothing. Since the docs say that "Particles are extended Sprites" I would assume that you can add and run animations in the same way that you do an a normal sprite? Any help would be greatly appreciated!! var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create });var emitter;function preload() { game.load.spritesheet('partAnim', 'assets/partAnim.png', 134, 141);}function create() { game.physics.startSystem(Phaser.Physics.ARCADE); game.stage.backgroundColor = 0x337799; emitter = game.add.emitter(0, 0, 100); emitter.makeParticles('partAnim'); emitter.gravity = 200; game.input.onDown.add(particleBurst, this);}function particleBurst(pointer) { emitter.x = pointer.x; emitter.y = pointer.y; emitter.start(true, 2000, null, 1); var part = emitter.getTop(); part.animations.add('run');'run', 15, true); console.log(part);}
  25. fiverivers

    Black page, nothing showing.

    Here is my code: I'm just presented with a blank screen. I am hosting with XAMPP.