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

Found 2,858 results

  1. 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!
  2. 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?
  3. 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.
  4. 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.
  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. 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!
  7. 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!
  8. 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
  9. 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.
  10. 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.
  11. 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.
  12. TweenLite error

    Hi, I'm having a problem with using TweenLite. Is there any way to use it with phaser?
  13. 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.
  14. 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.
  15. 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
  16. 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.
  17. 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...
  18. 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.
  19. 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
  20. 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.
  21. 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?
  22. 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 ?
  23. 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
  24. 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.
  25. 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.