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

  1. Hi there, I'm trying to get off the ground with creating my own phaser games, but I've hit a blocker that I just can't work out. I have a very basic setup, based on the Phaser Tutorial examples: index.htmljsphaser.min.jsassetsstarfield.pngThis is my very, very basic index.html code - but it falls over at the first hurdle when I try to access a game.physics method: <!doctype html><html> <head> <meta charset="UTF-8" /> <title>hello phaser!</title> <script type="text/javascript" src="js/phaser.min.js"></script> </head> <body> <script type="text/javascript"> window.onload = function() { var game = new Phaser.Game(1900, 1000, Phaser.AUTO, '', { preload: preload, create: create }); function preload () { game.load.image('starfield', 'assets/starfield.png'); } function create () { game.physics.startSystem(Phaser.Physics.ARCADE); // The scrolling starfield background starfield = game.add.tileSprite(0, 0, 1900, 1000, 'starfield'); } }; </script> </body></html>In Chrome I get the following error: Uncaught TypeError: Object #<Object> has no method 'enable' (index):48 create(index):48 d.StateManager.loadCompletephaser.min.js:4 d.Game.loadCompletephaser.min.js:5 d.SignalBinding.executephaser.min.js:4 d.Signal.dispatchphaser.min.js:4 dispatchphaser.min.js:4 d.Loader.nextFilephaser.min.js:10 d.Loader.fileCompletephaser.min.js:9 This is all running locally under Apache. I have tried a few other basic things, but whenever I try to access any Phaser object methods I get this same 'Uncaught TypeError' issue. I have phaser-examples set up locally, and these run just fine - as do the Phaser Tutorial examples. I have been trying to just build out from the tutorials to experiment and get to grips with everything. I assume it's a really dumb error, but I just can't see where I'm going wrong. Any tips would be gratefully accepted. Thanks, Stu
  2. I'm a total newb to both p2.js and phaser, but I can't seem to find any tutorials whatsoever for using p2.js for physics and phaser for rendereing. All I've found are threads here where they bring it up, and then someone replies that Phaser will integrate it soon, and the first guy either figures it out or does something else. Could someone please give an example of using the two, or even better a tutorial? Thanks in advance!
  3. Default drag

    Hey I have a feature where a sprites velocity becomes the velocity of a moving platform when landing on it which worked fine. I have now however tweaked some of the controls including the drag.x and now when riding the platform the sprite slips off? I have also tried to change the drag to 0 when the sprite is on the platform but I get he same thing happen? Not sure of there is a way to essentially turn drag off or to whatever it is initially? Thanks
  4. Cannot view sprite render/debug

    Hello again everyone. I'm having trouble with trying to look at my characters collision box. I was looking at this example and I implemented the offset collision to my character, the problem is viewing how it looks like just like in the example. I am currently using the basic template provided on Github, and it doesn't seem to incorporate a render function. I tried to add one, but I kept getting errors.
  5. Physics collision question

    Hello, folks! I'm making simple game, "Landing on the Mars". This is a link Currently, I'm stuck with the ground generation. I'm using a poligon to emulate uneven ground. But, in this case, physics system works wrong Collision doesn't happen with polygon body, but little above its borders. I've tried to play with body.translate(), but got nothing And second question, how can I fill the ground polygon with texture? I've tried Pixi mask, but no luck Any help very appreciated! :-) Code: function groundGenerator(){ var points = []; points.push(0); points.push(getRandomInt(0, 50) - 30); for(var x=getRandomInt(50, 150); x<1024; x+=getRandomInt(10, 100)) { points.push(x); points.push(getRandomInt(0, -150) + 10); } points.push(1024) points.push(0); points.push(1024) points.push(49); points.push(0) points.push(49); return points;}function create(){ game.physics.gravity.y = 15; bg = game.add.tileSprite(0, 0, 1024, 512, 'background'); bg.body.allowGravity = false; ship = game.add.sprite(512, 100, 'ship'); ship.body.collideWorldBounds = false; ship.anchor.setTo(0.5, 0.5); ship.body.setPolygon(5, 5, 30, 5, 30, 35, 5, 35); var points = groundGenerator(); ground = game.add.sprite(0, 512 - 50, 'ground'); ground.body.setPolygon(points); ground.body.backgroundColor = '#111111'; ground.body.allowGravity = false; ground.body.immovable = true;}function collisionHandler(ship, ground){ console.log("ship landed"); isLanded = true; console.log(vSpeed); if (ship.angle != 0 || Math.abs(hSpeed) > 20 || vSpeed < -40) { ship.kill(); explosion = game.add.sprite(ship.body.x, ship.body.y, 'explosion'); setTimeout(function() {explosion.kill();}, 150); // explosion } else { resetPhysicsOnLanding(ship); } acceleration = 0;}
  6. HitArea - Phaser 2.0.0

    Hi, I can´t find any information on how to use the new hitArea property for Phaser 2.0.0, I want to use this to check whether the face of a character is clicked/pushed or if it the rest of the body that is clicked. I am pretty new to Phaser so hopefully someone can help me at either showing me where to find the documentation on this or give an example of how to set an area and how to check if this area is clicked. Thanks in advance!
  7. Hey I'm trying to find a tool that will let me export the correct style JSON to add to a sprite using the .setPolygon() method. I've tried all the export settings from PhysicsEditor and none seem to provide the correct JSON. Is this the best tool to be used to create points from a shape with a transparent background? The polygon itself is quite complex, consisting of around 400 points. I wonder if it's even possible with this many points?
  8. Robo Dash

    Robo dash is a project that I have been working on for a couple of days now. I started a independent software studio back in 2012 named 'Somnibyte', and since 2012 I have been experimenting, but experimenting without any production. And so today I am happy to say that this is my first HTML5 game to be produced. It may still have some features to be implemented. I went with the theme of challenging/addicting, and so Robo Dash was the result. Robo Dash features a small robot toy named, 'Gamma'. The player is suppose to move Gamma across the kitchen table to dodge oranges that fall from the kitchen cabinets above. I hope you all enjoy this game. Feel free to post some feedback, ideas, bug reports, or comments. [ROBO DASH GAME] *Currently not optimized for mobile use, changes will take place soon.
  9. Center Fullscreen

    Hey guys, I think this is a newbie question. I'm using this.stage.scale.startFullScreen(); to make my game go fullscreen. When it does, the game is off to the side and doesn't fill the whole screen. I was wondering how I could center the game? Thanks, and I'm using the basic mobile template if that helps.
  10. [phaser] !pop (W.I.P)

    Hey everyone. I created a simple game to teach me more about phaser as well as the whole marketing aspect of Html5 game dev (, leadbolt, etc ... ). I posted it up in the #FeedbackFriday thread on reddit here. Feel free to check it out!
  11. Slow tilemap :c

    Hi everyone !I'm trying to display a part of a huge tilemap, so I think I have to add sprites in the render part like this : function preload() { game.load.image('tile', 'graphics/tile1.png'); } var map_x = 100; var map_y = 100; var map = new Array(map_y); for (var i = 0; i < map_y; i++) { map[i] = new Array(map_x); } var tiles = map; var speed = 4; var draw = true; function create() {, 0, 32 * map_x, 32 * map_y); cursors = game.input.keyboard.createCursorKeys(); mapen.generate(map, level, map_x, map_y); // Generate a map in map.js * 16 - 600, map_y * 16 - 335); }// Update function with movements function render() { //TODO: render map var poscx = Math.floor( / 32); if (poscx < 0) poscx = 0; var poscy = Math.floor( / 32) - 1; if (poscy < 0) poscy = 0; for (var y = poscy; y < poscy + 23; y++) { for (var x = poscx; x < poscx + 39; x++) { switch (map[y][x]) { case 0: break; case 1: tiles[y][x] = game.add.sprite(32 * x, 32 * y, 'tile'); break; } } } }}; When I move the tilemap, the game become slower and slower... I tried to display all the tiles at once in the create() part but it's slow too :c I think I need to create in memory each tile and then display the one I need or delete the useless tiles, but I don't really see how I could do that ! Thanks for your help !
  12. Hello everyone. Recently I uploaded my game on the web using cocoonJS. I got the email momentarily and (I do not know if I was suppose to do this or not) I tried to click the link using my phone's email client. The link lead to a blank page. I was using an iphone at the time for testing purposes. I don't know if my file structure inside the ZIP was organized in a way to work or not, because the game runs fine on a desktop. Can anyone tell me how they prepared their ZIP file for cocoonJS and how your file structure looks like? Also was it wrong to open the link within the phone? Thank you all in advance.
  13. Click On An Image not working

    Hi All, I have recently started exploring phaser. I am struggling with the event. Problem is that the click event is not firing after every click. It fires after clicking sprite multiple times. I have even tried phaser example "02 - click on an image.js" which comes with the download but i am facing same issue with the example. I have also tried same example from following link but problem is the same there too . I am testing on my PC (window 7) on chrome and firefox. here is my code window.onload = function () { var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create}); function preload() { game.load.image('einstein', 'phaser.png'); } var image; function create() { image = game.add.sprite(0, 0, 'einstein'); image.inputEnabled = true;, this); } var n = 0; function listener() { alert('a'); n++; } };
  14. Timer Issues

    I implemented a repeated event in which calls a function to drop items on a player. Psuedo code is down below: Create a variable that stores a timed repeated event Create a variable that increases a counter for the next timer that drops another set of items onComplete-incremement the timer so that a trigger notifies another timer to make another repeated event My problem is the 'onComplete' method. I've been getting a load of errors for a couple hours of trial and error with no avail. Can anyone explain how this works? I want to know the correct syntax for the onComplete method of a timed event. My trial ended up like this: lvl1 = * 4, 10, this.objectDroppingFunction, this);//Level one drops items on the player lvl1.onComplete(this.incrementCounter, this);//onComplete I call a function that increments the counter//I get the error: Uncaught TypeError: Object [object Object] has no method 'onComplete' Thank you all in advance. I may have also read the documentation wrong. Does the onComplete check to see if a specific timer has finished or ALL timers? If all timers, than how do I "check" individual timers when they stop individually?
  15. Collision question

    Hello, I have created a platform game where the main character can run in front of crates and then jump up to land on top of them as seen in Mario etc. I have tried setting the relevant tiles to only collide on the top face, however this leads to the main character getting sucked up on top of the crate whenever any part of his body collides with the top of the crate. So if you are stood in front of the crate, jump, half of the body goes through the top of the crate as expected before the sprite is pushed on top of the crate. I have tried a few ways of getting around this such as changing the collision of the crate tiles, judging on whether the bottom of the sprite is above the crate but have not managed to get this working. Any help would be appreciated, cheers!
  16. tweening to set positions

    Hello. I've been trying to setup some way to tween my sprite to 3 set areas on the screen, but it ends up going from 1 side to the other. left = game.input.keyboard.addKey(Phaser.Keyboard.LEFT); left.onDown.add(function () { pos > -2 ? pos-- : pos; if (pos == 1) { game.add.tween(ufo).to({ x: 400 }, 1000, Phaser.Easing.Linear.None, true, 0); } else { game.add.tween(ufo).to({ x: 250 }, 1000, Phaser.Easing.Linear.None, true, 0); } }, this);right = game.input.keyboard.addKey(Phaser.Keyboard.RIGHT); right.onUp.add(function () { pos<2?pos++:pos; if(pos==-1) { game.add.tween(ufo).to({ x: 400 }, 1000, Phaser.Easing.Linear.None, true, 0); } else { game.add.tween(ufo).to({ x: 950 }, 1000, Phaser.Easing.Linear.None, true, 0); } }, this); what am I doing wrong?
  17. [Phaser] Zlotnan

    Hi everyone, I just finished new small game using Phaser: So check it out and any feedback will be appreciated. Thanks!
  18. It's mandatory to use tiles?

    Hi! I'm researching the Phaser Framework and my question is: To use Phaser it's required to buid my game is tilemaps? I can't use sprite based graphics? Example: Shank, Rayman, Braid, etc are sprite based. Or, i'll have to use tilemap, but only the invisible collision rectangles will be tile based? Thanks!
  19. [Phaser] Shear Genius

    The title refers to the mad-scientist based contraption in the game, not the game itself which is silly bordering on inane. :-) Hey. This is a non-violent high-score action game about shearing sheep. I created it mainly as an exercise to learn Phaser and to see if Phaser and I would get along (we do—Phaser is awesome). I haven't spent any time optimizing it for mobile at all yet but it runs well enough on the desktop. I'll optimize and add leaderboards and CocoonJs-ify it later. Anyway, I'm putting this away for now while I work on #cyberpunkjam and #7drl. The best score I've been able to get is about 120,000. Feedback is welcome. Thanks!
  20. [Phaser] Louie's Dog

    Hi there, just want to share my HTML5 games, Louie's Dog. Although this is my first time posting here, this is not my first HTML5 games. Maybe I can share the other games here later. Louie's Dog is a grid sliding puzzle games where you must reunite Louie and his missing white dog. Beware though, there are other special tile to consider, and Angry Dog & Animal Control Officer to avoid. You can also find hidden gold bones under the ground to increase your completion rating. There are no timer or score here, so just sit back, relax, and solve all the level with all the time in the world Link: Alternate Link: If you have problem playing the games, do let me know. Any feedback will be appreciated!
  21. I would like it so that when a certain event happens, the player completely stops moving (for a few seconds or so), the user does not have the ability to move at all, and I am then able to proceed to call a function (which calls a function to end the game). How would I implement this? Here is a snippet of code located in my Update function: (Please note: I am using the Phaser basic template, so when calling functions and methods, we must use 'this'. if (, certainItem)) { var hit ='hit');; certainItem.kill(); player.body.velocity.x = 0; // Tried to stop, but I am still able to move him'hit'); // Changes to the frame I wanted but then quick //-ly changes back // this.gameOver(); }Thank you in advance.
  22. Blurred images on iPhone

    Hi guys, I've been playing around with Phaser for the last couple of weeks and I'm really loving it, very easy to work with and fun too! I have come across an issue however, I'm sure I'm probably doing something silly so I'm hoping someone can point me in the right direction. The issue: I come from a web dev background, so for my images, I've made them double the size and then using scale.setTo(0.5,0,5) to shrink them to the size I want them to display at. That's all fine, however when I use the game on my iPhone the images appear rather blurry instead of nice and crisp. Can anyone point me in the right direction here, am I doing something wrong? Thanks, Martin
  23. Hi, I just changed from 1.1.2 to 1.1.4 and i can't detect to collision side of my sprite. define("Play", ['Game', 'Holoboy'], function(Game, Holoboy) { var Play = function (){ = Game; this.holoboy;; this.layer; }; Play.prototype = { preload: function(){, 0, 'preloaderBackground'); }, create: function(){ this.holoboy = new Holoboy(0,0); ='map');'tiles');, 12); this.layer ='Calque de Tile 1'); }, update: function(){ this.holoboy.move();, this.layer); console.log(this.holoboy.sprite.body.touching); } } return Play; });My console.log(this.holoboy.sprite.body.touching); always alert me Object {none: true, up: false, down: false, left: false, right: false…} My holoboy object : My controllable object : The collision works well by the way. My character can jump on the tiles and he is stopped by them. What's wrong with my code? Thank you
  24. I have been working on a tile-based rogue-like exploration game that is supposed to be very relaxing and peaceful. A lot of it is procedurally generated, and I wanted to procedurally generate the music, too. So I loaded two octaves of notes in the pentatonic scale:'notec', ['../wp-content/themes/toolbox/js/assets/music/notec.ogg','../wp-content/themes/toolbox/js/assets/music/notec.mp3']);'noted', ['../wp-content/themes/toolbox/js/assets/music/noted.ogg','../wp-content/themes/toolbox/js/assets/music/noted.mp3']);'notee', ['../wp-content/themes/toolbox/js/assets/music/notee.ogg','../wp-content/themes/toolbox/js/assets/music/notee.mp3']);'noteg', ['../wp-content/themes/toolbox/js/assets/music/noteg.ogg','../wp-content/themes/toolbox/js/assets/music/noteg.mp3']);'notea', ['../wp-content/themes/toolbox/js/assets/music/notea.ogg','../wp-content/themes/toolbox/js/assets/music/notea.mp3']);'notec2', ['../wp-content/themes/toolbox/js/assets/music/notec2.ogg','../wp-content/themes/toolbox/js/assets/music/notec2.mp3']);'noted2', ['../wp-content/themes/toolbox/js/assets/music/noted2.ogg','../wp-content/themes/toolbox/js/assets/music/noted2.mp3']);'notee2', ['../wp-content/themes/toolbox/js/assets/music/notee2.ogg','../wp-content/themes/toolbox/js/assets/music/notee2.mp3']);'noteg2', ['../wp-content/themes/toolbox/js/assets/music/noteg2.ogg','../wp-content/themes/toolbox/js/assets/music/noteg2.mp3']);'notea2', ['../wp-content/themes/toolbox/js/assets/music/notea2.ogg','../wp-content/themes/toolbox/js/assets/music/notea2.mp3']);And then I called a function every time the person took a step: sound_track: function() { // random music generation if ((stepcounter % 2) == 1) { ckey ='notec'); dkey ='noted'); ekey ='notee'); gkey ='noteg'); akey ='notea'); c2key ='notec'); d2key ='noted'); e2key ='notee'); g2key ='noteg'); a2key ='notea'); ckey.volume = .3; dkey.volume = .3; ekey.volume = .3; gkey.volume = .3; akey.volume = .3; c2key.volume = .3; d2key.volume = .3; e2key.volume = .3; g2key.volume = .3; a2key.volume = .3; console.log("this part's working"); var randtime = Math.floor(Math.random()*8)+1; var randmusic = Math.floor(Math.random()*12)+1; if ((randtime == 1) || ((stepcounter % 4) == 1)) { // guaranteed beat console.log(randmusic); if (randmusic == 1 || randmusic == 11); if (randmusic == 2); if (randmusic == 3); if (randmusic == 4); if (randmusic == 5); if (randmusic == 6); if (randmusic == 7); if (randmusic == 8); if (randmusic == 9); if (randmusic == 10); } } },Which seemed to work fine! (Albeit a bit random: I need to write a few more rules, perhaps a bassline, to give the song more structure. But it's already very zen!) Anyway, this works great for the first hundred or so steps, but then the audio starts to get all staticky. Eventually, it stopped playing at all, and I had to reload the window. I thought maybe I could fix this by making the files shorter and more compressed, and I did that, and it seemed to help a bit, but the audio still got pretty corrupted-sounded and eventually stopped all-together. This affects all audio played by the code, even sound effects which have not been played more than a few times, and does not go away if I wait. I am not a programmer, and this is just a side project for me. So it's very possible that I am doing something silly, or stupid, or preposterously round-about. If so, please correct me! I have really enjoyed the experience of coding in Phaser, and it's been a lot of fun, but this kind of bug (which throws no errors in the console!) totally perplexes me, as it falls outside the realm of internal code-logic and into the realm of technical know-how, of which I have none. (If you would like to test the game out, you can find it a, and the password is trails. It's not completely finished, though, so there might be other bugs!) Also, a PS: I have lurked in these forums and used people's advice to solve a number of issues already. This seems like a great place, and you all seem like great people, and I'm excited to finally register and start contributing (even if my first contribution is a request for help!). Thank you all. EDIT: Well, I think I've figured it out! The problem was that I was doing the "ckey ='notec');" stuff (I'm not actually sure what this is called, only how it functions!) every single time the sound effects were called. This was overloading something and making the sound sound horrible. Hopefully somebody else will do the same stupid thing and this post will serve as helpful information to them!
  25. Hello everyone, I have a question on optimizing a Phaser game for mobile use. Recently I made a new game, but for now it can only be used on the Desktop. How do you optimize the game in order to place it on IOS without going on a mobile browser? I currently was thinking about using Phonegap, does anyone have any other recommendations except this one? Also, I have been having an awkward situation with the font system for the engine. Can anyone help me with this issue? I do not want to repeat my post again, and so the post to the original, which includes source code, is down below: Thank you all in advance.