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,316 results

  1. Zeterain

    Bitmap Text Layering

    This is probably most easily explained with an example. If I create sprite one, then bitmap text, then sprite two, I'd like the bitmap text to be above sprite one but bellow text two. Here's some code demonstrating what I mean: var sprite1 = game.add.sprite(0, 0, 'image');var bitmapText = game.add.bitmapText(0, 0, 'the text', styleObject);var sprite2 = game.add.sprite(0, 0, 'image');However, in this case bitmapText is always rendered on top, and sprite2 is above sprite1. In fact, no matter what I do, any bitmap text will always render on top of everything else. Is there any way to change this?
  2. Hi, Is there a way to create some planet gravity like Angry Birds Space. And i want to turn the camera like REUS? How can i do this, or does it exist some articles who explain that? Thank you See If a moderator see this, you can delete this post. Thank you
  3. the "mapcollide" example does not seem to work properly in 1.1.x. jumping doesn't seem to work, and it looks a lot different from the way it did in 1.0. here is what it looked like in 1.0.x: here's how it looks to me since 1.1.3: and jumping doesn't seem to work. i rely on the examples to make sure i'm doing things right, so when the examples are broken, it makes me uneasy. any thoughts? thanks!
  4. aladine

    How friendly Phaser is ?

    Hello everyone, 3 months earlier i wanted to start learning HTML5 game development and somehow i found myself turned into unity3D and to be honest i don't regret that at all, i've been involved in the game development field for almost 4 years now and i never finished a single game which is something that i proudly did with unity3D, and i guess the reason of that was 1st my knowledge of the C# language, the tools available inside the unity engine and the super helpful unity community. because of these reasons i wasn't able to only finish my first game, but i actually had 4 offers to work as a freelancer for mobile game development and for the first time in my life, i have made some decent incomes from game development. Now the question is, as someone with Java background, a unity3D developer with C# and NEVER made a HTML5 game, how helpful Phaser would be for me ? and why should i choose it instead of one of the many available html5 engines and framework out there ? PS : currently am reading the Phaser's getting started documentation and later i will give this tutorial a try : Making your first Phaser game so maybe i could answer the previous question myself, but i thought this is a topic that can be useful for anyone later, so, thank you for your help have a nice day
  5. magictrickskill23

    Collision and Sprite Animations

    Hello! I am working on a project at the moment, I had collision detection working for a player sprite to pick up a coin, but when I added in animation it stopped working! Can anybody help me please? var bg, hm, fixed, land, counter;var game = new Phaser.Game(500, 500, Phaser.AUTO,'',{preload: preload, create:create, update:update});function player(){ dx:0; dy:0; dist:0; time:0; speed:100; counter:0; moveBool:false; newX:0; newY:0; fps:5; xy:0;}function preload(){ game.load.spritesheet('playerSprite', 'images/character.png',32,32); game.load.image('bg','images/bg.jpg'); game.load.image('coin','images/coin.png'); game.load.image('hpxp','images/healthexp.png'); //'BG', ['Travel.mp3']); //music ='BG'); //;}function create(){, 0, 2000, 2000); land = game.add.tileSprite (0, 0, game.width, game.height, 'bg'); land.fixedToCamera = true; playerSprite = game.add.sprite(256, 256, 'playerSprite'); playerSprite.body.collideWorldBounds = true; playerSprite.animations.add('down', [0,1,2,1], 10, true); playerSprite.animations.add('left', [3,4,5,4],10, true); playerSprite.animations.add('right', [6,7,8,7], 10, true); playerSprite.animations.add('up', [9,10,11,10], 10, true); = 'player'; sprite4 = game.add.sprite(700, 220, 'coin'); = 'coin'; sprite3 = game.add.sprite(500, 110, 'coin'); = 'coin2'; sprite2 = game.add.sprite(40, 60, 'coin'); = 'coin3'; console.log('sprite2 created'); sprite2.body.customSeparateX = true; sprite5 = game.add.sprite(880, 600, 'coin'); = 'coin4'; sprite6 = game.add.sprite(1120, 300, 'coin'); = 'coin5'; hpxpbar = game.add.sprite(10, 10, 'hpxp'); = 'bar'; hpxpbar.fixedToCamera = true; text = game.add.text(80, 60, "Score: " +counter, { font: "25px Arial", fill: "#ff0044", align: "center" }); text.fixedToCamera = true; text.anchor.setTo(0.5, 0.5); playerSprite.anchor.setTo(0.5, 0.5); playerSprite.body.collideWorldBounds = true;; = new Phaser.Rectangle(200,200, 130, 130);, 0); //;}function getThere(){ player.speed = 100; player.newX = game.input.worldX; player.newY = game.input.worldY; player.dx = Math.round(player.newX-playerSprite.x); player.dy = Math.round(player.newY-playerSprite.y); player.dist = Math.round(Math.sqrt(player.dx*player.dx+player.dy*player.dy)); player.time = Math.round((player.dist/player.speed)*1000); player.moveBool = true; console.log("x" +player.dx); console.log("y" +player.dy); player.xy = Math.abs(player.dx)-Math.abs(player.dy); console.log(player.xy); playerAnimation();}function update() { //game.physics.collide(playerSprite, sprite3, collisionHandler2, null, this);// game.physics.collide(playerSprite, sprite4, collisionHandler3, null, this);// game.physics.collide(playerSprite, sprite5, collisionHandler4, null, this);// game.physics.collide(playerSprite, sprite6, collisionHandler5, null, this); game.input.onDown.add(getThere, this); if(player.moveBool){ game.add.tween(playerSprite).to({ x: player.newX, y:player.newY }, player.time, Phaser.Easing.Linear.None, true); player.moveBool = true; } if(playerSprite.x==player.newX && playerSprite.y == player.newY){ playerSprite.animations.stop(); } land.tilePosition.x =; land.tilePosition.y =; game.physics.collide(playerSprite, sprite2, collisionHandler, null, this); console.log("collision set");}function playerAnimation(){ if(player.dx<0 && player.xy > 0){'left'); if(playerSprite.x==player.newX && playerSprite.y == player.newY){ playerSprite.animations.stop(); playerSprite.frame=1; } // console.log(player.dx); } else if(player.dx>0 && player.xy > 0){'right'); } else if(player.dy<0 && player.xy < 0){'up'); } else if(player.dy>0 && player.xy < 0){'down'); }} /* if (cursors.left.isDown) { player.body.velocity.x = -150; if (facing != 'left') {'left'); facing = 'left'; } }*/function collisionHandler (playerSprite, sprite2) { sprite2.kill(); console.log( + ' collided with ' +; updateText();}/*function collisionHandler2 (obj1, obj2) { obj2.kill(); console.log( + ' collided with ' +; updateText();}function collisionHandler3 (obj1, obj2) { obj2.kill(); console.log( + ' collided with ' +; updateText();}function collisionHandler4 (obj1, obj2) { obj2.kill(); console.log( + ' collided with ' +; updateText();}function collisionHandler5 (obj1, obj2) { obj2.kill(); console.log( + ' collided with ' +;updateText();}*///function render() { /* game.debug.renderCameraInfo(, 32, 32); game.debug.renderSpriteCoords(hm, 32, 200); game.debug.renderSpriteCoords(fixed, 600, 200); *///}function updateText() {player.counter++;text.setText("Nope: " + counter);}
  6. Hey, I have problem with tileset. When i load spritesheet from i saw only black screen with player sprite. But when i use spritesheet from Phaser example all work fine. I tested it on sources from example ( Someone have a idea ?
  7. Breakout I'm more than happy to release my first finished game. I made it specially for this project: So soon I hope it will appear on the list, and for now you can play it here: Source code here: I've made some gameplay changes compared to the other engine ports/versions and they are more like bonus features. If you press: "B" you will toggle mouse/keyboard control If you press: "S" you will toggle a "shake" effect If you press: "V" you will spawn a ball (there is no collision check till the countdown ends so don't freak out if the ball pop out of the game bounds. Other things it that you can save a ball if hit it with the vertical side of the paddle but only if it hit the top half - I call it "action save" or "phew just in time save" Also when multiple balls are in game they collide with each other.
  8. rodrigezer

    Keep looping without focus

    Hello. Canvas loop auto pause when the page are in focus, but when i'm in other page or minimize the chrome the loop game is in auto puase, is there a way to change it? i want to keep looping all time. TY
  9. benny!

    Device class and msPointer

    Hi, the Device class by phaser (refer to line 339) sets the touch property to true on IE10, Windows7, because of the msPOinterEnabled property. if ('ontouchstart' in document.documentElement || window.navigator.msPointerEnabled) { this.touch = true; } This confuses me since no touch events are fired. As I can read in the msdn - our lovely friends from M$, fires pointer events instead of touch events. Besides, in my case, no pointer device is attached anyway, and only normal mouse events are triggered. So, my question is - is it correct to equalize pointer events with touch events? How do you guys handle pointer events? Thanks for any enlightenment ;-) Best, benny!
  10. Im using phaser (1.0.6) for my game, but I suspect this to be so low level so Im putting it here. I have a spritesheet of three frames. The zebras looking to the left are unchanged and simply rendered, those looking to the right are flipped using scale.x = -1. What happens is pretty much what the topic say. The first row shows the behaviour of the system for textures with odd dimensions, the second one is for even sized textures. I render using pixi canvas renderer. Anyone can reproduce this, or knows a better workaround that simply creating all your pix with even dimensions?
  11. Arlefreak

    Detect collision on a sprite side

    is there a way to handle collisions of an object depending on the side colliding? for example top, bottom, left, , right so for example I have a character and I want it to do something when it collides on the left side of a sprite, but when it is on top, just continue. PD: i think the chat is down, I don't know if it is known.
  12. Terumi

    Tween -> run function -> tween

    Hello, Is it possible to tween an object, run a function, and then tween again in a sequenced fashion? What I want to achieve basically is to tween a sprite out of the stage, teleport it to certain x/y and tween it again back to stage... Thank you.
  13. Tácio Sousa

    Game.input.onDown question

    Hi people, i'm here again with new questions. I started a Space Invaders project with Phaser, and I set the ship (player) for move when one sprite (with inputEnabled = true) dispatch his input event (, this)). The player moves normal, but if you click the button and continues holding him OUT of the button, the player will continue moving forever, until you click one more time in same button to call the onInputUp function. I can use the game.input.onUp to fix the release of button, but here comes the question : How i do for game.input.onDown return a Sprite if there's one clicked? I need something like "return the sprite at inputX and Y" on update function, for substitute the button events for game.input.onDown and make the buttons work like any other game. If a cannot resolve this, the player will always have to click and release all buttons for move instead hold the finger and only move towards the right button, as we make in any virtual D-Pad.
  14. Rex Rhino

    Scaling the stage?

    I am wondering if/how it is possible to scale the stage, in order to get a zoom effect on the game world. I have tried a whole slew of things, I have looked over the source code, but I still can't figure it out. Any help would be greatly appreciated!
  15. rmbennin

    Texture Error with JSONHash?

    Hello, I've looked all over for an explanation as to why I'm getting this error: "Texture Error: frame does not fit inside the base Texture dimensions [object Object]". I believe it is happening from loading in my sprite for my game, but I'm not sure. I used Flash to create a JSON and a PNG file for the sprite, and they both look valid. I'm using this code to load in the sprite: "game.load.atlasJSONHash("chef", "assets/sprites/chef-spritesheet.png", "assets/sprites/chef-spritesheet.json");" Thanks!
  16. BJJ Enterprises

    Flixel -> Phaser

    Hello everyone, I came across with this framework, and when I saw it was done by a Flixel member it caught my attention, specially with the HTML5 and portability to several platforms! I have a game all done in Flixel, and that's one of the points my and my team are sad it+s the portability, to android, to iOS, which is kinda difficult at the point we are at. What I wanted to know is that if anyone tried to Port a Flixel game to HTML5, using Phaser, and if it is easy or not! Thanks
  17. When using Flixel I would have a gamestate, a player, enemy, perhaps coins etc as separate classes. Maybe a registry that stored assets etc. I had been tooling around with ImpactJS and that framework uses a similar structure. How do I implement a structure like this with a Phaser game? I only want the the index.html to set the css etc and load the game.
  18. Hello guys, I'm new to HTML5 game dev and new to this community, but still I want to share my tutorial about Introduction to the Phaser framework. This tutorial is about Pong game. Demo: Full tutorial: Any feedback found be great. Thank you in advance.
  19. isfuturebright

    Getting Browser Info

    Is there any way to get browser info via Phaser? I saw that this link here says how to do it but I was wondering if Phaser already has something in it.
  20. Rafus

    TweenLite error

    Hi, I'm having a problem with using TweenLite. Is there any way to use it with phaser?
  21. rungo73

    absolute beginners Tutorial

    Hi, I've come here from As3 and Flixel but am a complete newb in terms of html5 development. Can anyone point me in the direction of a begnners tutorial for phaser? and perhaps API documentation? I've gone through the basic steps on the site and have got the logo spinning. but now Im after next steps. Specifically I'm after info on best practices, project structure etc My next goal is to get a sprite mvoing around, then animate it. Any help, guidance would be very much appreciated.
  22. Hi. I started reading all post in this forum from the oldest to the newest in order to understand Phaser a little better and to see if I find out some of my own doubts already asked / answered. Notwithstanding I have some very basic doubts about how to configure my development environment (I think that mainly because I'm still learning JavaScript). Currently I'm creating a folder with the following structure (It's based in the post Is there a tutorial on a basic setup for Phaser?): mygame/+ +-img/ +-lib/ | +-phaser-min.js +-snd/ +-src/ | +-game.js | +-file1.js | +-file2.js +-index.htmlWhere file1.js, file2.js, and so on are files called by game.js My next step would be to generate an output folder ( say, named build ) that would contain all JavaScript merged into a single file as well as minified. Something like the following: mygame/+ +-img/ +-lib/ | +-phaser-min.js +-snd/ +-src/ | +-game.js | +-file1.js | +-file2.js +-index.html | +-build/ +-img/ +-snd/ +-game.js +-index.htmlThe point is I don't have any clue how to do it. Is there any script / tool available for that? Preferably command line tools that I can call from shell scripts / bat files or directly from VIM. Another point I'd like to understand is the folder structure of Phaser. I imagine that for develop a game I just need to use either phaser.js or phaser.min.js file and that the remaining files are either for development of Phaser itself or example files to guide us. Right? What's better to use during game development: either phaser.js or phaser.min.js file? Regarding the index.html file, in examples, usually I see JavaScript embedded in it: <script type="text/javascript">(function () {...})();</script>Can't I just create a function (say run()) and call it: <script type="text/javascript">run();</script>Is there any implication in doing this? Any special care I should take? If someone could point me how to debug the my code it would be nice. Any other tips you judge useful are very much appreciated. Thank you all.
  23. Hey there. I'm fairly new to making games, let alone making them using Phaser.js. Sorry if this question is outright stupid or silly for one reason or another, I really don't know much so I thought I'd ask here. I have recently started playing with Node and and it got me thinking.. how would I go about combining this and Phaser.js? Is there a particular set of steps that I have to undertake in order to make this work? At the moment I'd like to just have a sprite rendered using Phaser on each client and give them an ability to connect to each other (sort of like in this example, which I was using to teach myself the basics btw.). Again, sorry if it's a silly question, I haven't been doing this all for very long. Best regards and keep up the great work! Mariusz
  24. Madigan

    How does angle work?

    Hey folks! I'm trying to make a game of Asteroids, and I want to steer my ship! So I added the following code to change the angle: if(game.input.keyboard.isDown(Phaser.Keyboard.D)) player.angle++;It works at first, but then it gets stuck and the angle won't change. Generally this happens after 360* or so. I'm guessing that this has something to do with the number getting too large (which mathematically shouldn't make a difference, right?). I created a workaround: var rotation = 0;function update() { if(game.input.keyboard.isDown(Phaser.Keyboard.D)) player.angle = rotation++ % 360;}But creating my own rotation variable seems to defeat the purpose of having an angle variable in the first place. Am I doing something wrong? Is there a better way to make use of angle? I've been looking through the source, but I haven't had much luck yet (JavaScript is not my first language). Thanks & Regards.
  25. Hello. I have noticed that many examples of Phaser have their code wrapped in a "self invoking function" ( (function(){/*code*/})() ) which encloses the variables in a function scope. I'm not sure how people feel about this, but if you remove the wrapper, it would be possible to hack around with the examples from the javascript console, which is much more fun than having to change the code and refresh the page. (especially that there is currently little documentation, and the javascript consoles have code completion). Just a proposition...