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
    • Pixi.js
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered

Found 3,147 results

  1. 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
  2. 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.
  3. Error in Sprite.crop

    While using Sprite.crop I noticed that changing crop.width doesn't always work. For example, the following code won't have any effect: var sprite = game.add.sprite(0, 0, 'someSprite');sprite.crop = new Phaser.Rectangle(0, 0, sprite.width, sprite.height);sprite.crop.width = v; // some value vNow the following code will work without problem: var sprite = game.add.sprite(0, 0, 'someSprite');sprite.crop = new Phaser.Rectangle(0, 0, sprite.width, sprite.height);sprite.crop = sprite.crop; // adding this line fixes the problemsprite.crop.width = v; // some value vThe problem is inside crop's "set" function: set: function (value) { if (value instanceof Phaser.Rectangle) { if (this._cropUUID == null) { this._cropUUID =; PIXI.TextureCache[this._cropUUID] = new PIXI.Texture( PIXI.BaseTextureCache[this.key], { x: value.x, y: value.y, width: value.width, height: value.height } ); } else { PIXI.TextureCache[this._cropUUID].frame = value; } this._cropRect = value; this.setTexture(PIXI.TextureCache[this._cropUUID]); }}The first time we set a crop rectangle R, sprite._cropRect is assigned R but in PIXI texture cache we actually create a new frame instance. So if we set sprite.crop.width we do change the width of _cropRect but not the width of the texture's frame.
  4. 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...
  5. 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.
  6. Best size for game assests

    I will start making the resources for my game, and I wanted to know what is the best size to make my sprites, or my backgrounds? is it better to make a large asset and scale it, or make several sizes and load them depending on the resolution of the screen.
  7. Render in HTML Element

    I may be mistaken, but I think Phaser handles the generation of the canvas/WebGL markup/placement. Is it possible to give it a particular HTML element to render within?
  8. Spine support

    Sorry for asking again for the Spine ( support in Phaser. I didn't have the time to try it out but since Pixi is used for rendering I really wonder if this is already possible. Despite being so great Spine does not seem to get used a lot so I understand if you don't plan to integrate it in the near future (at least you didn't put it under "Future Plans" in the anymore). I guess I could wait for the documentation and then try to hack it in - maybe I can even get the code to look nice and make a PR though I doubt that Also thank you so much for your hard work on the 1.0 release! I followed the "march to 1.0" thread as well as the github commits so I can imagine how much effort you put into this
  9. I am trying to run the example "play sound 1" from Phaser 1.00TS083 Tests/audio, but it doesn't seem to work on mobile. On my iPod touch 4th gen with iOS 6.1.3, when running the example, the sound doesn't play when pressing the button and the browser crashes after a few seconds. Should this test be running on my iPod touch ?
  10. Weird Tilemap rendering

    Hello, I'm encountering a weird bug when I try to render a tiledmap (exported from Tiled) using Phaser : I've just modified the Phaser test suites and included my files to make sure that it wasn't a problem from my code and I still get the same problem. I've tested with the 095, 097, and 1.0TS083 test suites. This is what the map should look like : You can find the files causing problems here : Thanks
  11. This is my first Html5 game, I am using Phaser 1.00TS0.83 and I had a real fun making it. The basis of the game is simple: you need to connect all blocks, either by moving them or rotating them, there are 3 types of them and a total of 60 levels. You can play the game HERE Any feedback is welcome... Edit: I updated the game and added a music and sound effects.
  12. Elapsed function ?

    So I'm new to this, i have achived to do this, but i can't get the sprite to jump correctly, i was trying this metod but i can't find a elapsed function, any way to ahive this? PD: No pressure, but any news about 1.0 ? I'm looking forward to ir great work BTW PD: Sorry for the bad english.
  13. I've been using Phaser for more than a week now, making my first polished Html5 game. I have a good experience with Flixel, so I was looking forward to using Phaser. Yesterday I upgraded to 1.00TS083. I will try to post here all the problems, suggestions and even small fixes I've found. Overall, I've been pretty pleased with the framework. Getting something up and running on my iPod touch was relatively easy and the performance is good enough. I am sticking to 320x480 for now and the graphics scale really well on mobile. The various examples available with Phaser are really helpful and in general are enough to learn how to use the engine, although it's not uncommon to jump into Phaser's code just to get a better understanding of how things work. In the next posts I will point to some things I think are missing or incorrect in the engine.
  14. Starting with Phaser and Javascript

    Oh, please forgive me if I'm missing something so obvious here. I wish to use Phaser from Javascript and I don't know where to start, and since there is no API documentation, I'm completely lost. The test suit is something, but there are multiple things that I don't really get. For example, if I'd like to create a TileMap and populate it grammatically, what should I do? Also, are there some complete game examples or tutorials in Javascript that I could play with? Everything I find seems to be for Typescript.
  15. I really really, like the way phaser is setup, but at the same time I want pixi for my renderer. Is there any plan for implementing pixi in phaser or has someone done so? Or am I just crazy, and it's not a good idea? Regards, O.
  16. More questions about the Phaser workflow

    I'm here again with a little bit more questions. I want to know how i do to : - Pause the game. (I've tried game.pause, game.paused, game._paused and more other pause methods and all results in error) - Stop the game controls. (Things inside update, input checks, player moves, ...) - Play sounds/musics. I'm making a "Aero Fighters" clone, and i'll need this for the ending of every stage, something like "final stage animation". Thanks for anyone who help me.
  17. Hey, as requested in this thread - I made a small tutorial on how to setup phaser using FlashDevelop. This tutorial is based on the fantastic phaser-project-template done by jesse freeman. A flashdevelop project template is attached to this post. So, here we go... 1.) Install NPM 2.)Install typescript npm install -g typescript3.)Install and launch FlashDevelopThis tutorial uses FlashDevelop Version 4.4.0RTM 4.)Create a new TypeScript Project (Project->New Project->Typescript) 5.)Create a new folder within your project called "lib" 6.)Download PhaserThis tutorial uses Phaser0.9.5 7.)Copy Phaser directory (including the typoscripts) to you lib-folder 8.)Adjust project properties to compile to ES5 targetRight Click on Project Name -> Properties -> Build Tab -> add "--target ES5" to the Pre-Build Command Line textfield 9.)Press F8 (Build project) 10.)Open the bin/index.html in your browserNote: if you use assets please use a web server Hope this helps a bit. Best,benny!
  18. My game don't run iPad 1

    I'm here again with new problems! o/ I make this simple test game ( to check the input on mobile only clicking on the screen, and open him in one iPad 1 and another iPad 4 (both with safari browser). In the iPad 4 the game is running perfect (except when turning around the iPad, when you do this, the game disappear), but in iPad 1 the game doesn't run, and throws my old friend error : "undefined is not a function". Can anyone help me with this 2 problems?
  19. Another question about Input

    I want to know how i do (if this can be make) to change the "game.input" to "specificObjet.input", in this case i don't want the mouse click in all stage, but in only one specific "button" object (like the FlxButton or like some android and IOS games). Can anyone help me?
  20. Breakout Game - need help

    So I need your help to finish, and polish the Breakout game with Phaser. In short i make it for this: I've made like 50% i think, what's left is: - Start, Game Over Screen - Display Lives, Level, Score - Display the Countdown - Make powerups and powerdown fall from predefined random bricks (if you press "Z" you trigger the powerdown and paddle become smaller) - All sound related (here i wait for final version of Phaser) But there are some problems i met during the development: - I think that justPressed and justReleased doesn't work as expected i tried fixed it but failed... The problem is that even with one quick press, the update calls justPressed and execute code several times: Just press "V" to spawn a ball. Sam thing with "X" and "C" for switching levels, here i tried a bit hackish for me thing to set the duration as 22 ms... 11ms fails, and 44ms trigger multiple - I don't quite understand the paddle.immovable = true; but as i tested and read from flixel without it collision goes nuts and don't do what "expected imho" I'll be glad if Rich point me to some reading, or example - Still think how to implement the different play states Start scree, Playing, and Game over Here is the TS source: Also I'll be happy if someone takes a time the restructure the game to not be in one big .js And of course when this is finished it will be added to the Breakout projects, and i think it's going to be useful for all new comers to Phaser
  21. Phaser 0.9 Update

    Large refactoring. Everything now lives inside the Phaser module, so all code and all tests have been updated to reflect this. Makes coding a tiny bit more verbose but stops the framework from globbing up the global namespace. Also should make code-insight work in WebStorm and similar editors. Added the new GeomSprite object. This is a sprite that uses a geometry class for display (Circle, Rectangle, Point, Line). It's extremely flexible! Added Geometry intersection results objects. Added new Collision class and moved some functions there. Contains all the Game Object and Geometry Intersection methods. Can now create a sprite animation based on frame names rather than indexes. Useful when you've an animation inside a texture atlas. Added test to show. Added addKeyCapture(), removeKeyCapture() and clearCaptures() to Input.Keyboard. Calls event.preventDefault() on any keycode set to capture, allowing you to avoid page scrolling when using the cursor keys in a game for example. Added new Motion class which contains lots of handy functions like 'moveTowardsObject', 'velocityFromAngle' and more. Tween Manager added. You can now create tweens via Game.createTween (or for more control game.tweens). All the usual suspects are here: Bounce, Elastic, Quintic, etc and it's hooked into the core game clock, so if your game pauses and resumes your tweens adjust accordingly. Tidied up every single class now. Common header formats, started work on docs and lots of house keeping.
  22. Collision Question

    Hi, since I do not want to spam the announcement thread - I started to post a new thread for this question. I have not tried the code myself - but just browsing through the example codes I wonder what the "collides" variable should mean: myGame.collide(car, melon, collides); I do not see where it is instantiated referring to the following code: So, I assume it is undefined. Nevertheless, so far I really like the whole syntax of phaser. Looks pretty clean and simple. Best, benny!