Search the Community

Showing results for tags 'phaser'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • 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 a.data.onloadphaser.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 http://projects.lomakov.net/html5/Racing/index.html 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 (clay.io, 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() { game.world.setBounds(0, 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 game.camera.setPosition(map_x * 16 - 600, map_y * 16 - 335); }// Update function with movements function render() { //TODO: render map var poscx = Math.floor(game.camera.x / 32); if (poscx < 0) poscx = 0; var poscy = Math.floor(game.camera.y / 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 sprite.events.onInputDown 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 . http://gametest.mobi/phaser/examples/_site/view_full.html?d=basics&f=02+-+click+on+an+image.js&t=02%20-%20click%20on%20an%20image 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; image.events.onInputDown.add(listener, 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 = this.game.time.events.repeat(Phaser.Timer.SECOND * 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: http://zlotnan.strangevillage.com/ 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. :-) http://jotson.itch.io/shear-genius 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: j.mp/louiedog Alternate Link: https://dl.dropboxusercontent.com/u/47459072/louiesdog/index.html 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 (this.game.physics.collide(player, certainItem)) { var hit = this.game.add.audio('hit'); hit.play(); certainItem.kill(); player.body.velocity.x = 0; // Tried to stop, but I am still able to move him player.animations.play('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 (){ this.game = Game; this.holoboy; this.map; this.layer; }; Play.prototype = { preload: function(){ this.game.add.sprite(0, 0, 'preloaderBackground'); }, create: function(){ this.holoboy = new Holoboy(0,0); this.map = this.game.add.tilemap('map'); this.map.addTilesetImage('tiles'); this.map.setCollisionBetween(2, 12); this.layer = this.map.createLayer('Calque de Tile 1'); }, update: function(){ this.holoboy.move(); this.game.physics.collide(this.holoboy.sprite, 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 : http://pastebin.com/Uzpkihfw My controllable object : http://pastebin.com/FcEWkWS8 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: this.game.load.audio('notec', ['../wp-content/themes/toolbox/js/assets/music/notec.ogg','../wp-content/themes/toolbox/js/assets/music/notec.mp3']);this.game.load.audio('noted', ['../wp-content/themes/toolbox/js/assets/music/noted.ogg','../wp-content/themes/toolbox/js/assets/music/noted.mp3']);this.game.load.audio('notee', ['../wp-content/themes/toolbox/js/assets/music/notee.ogg','../wp-content/themes/toolbox/js/assets/music/notee.mp3']);this.game.load.audio('noteg', ['../wp-content/themes/toolbox/js/assets/music/noteg.ogg','../wp-content/themes/toolbox/js/assets/music/noteg.mp3']);this.game.load.audio('notea', ['../wp-content/themes/toolbox/js/assets/music/notea.ogg','../wp-content/themes/toolbox/js/assets/music/notea.mp3']);this.game.load.audio('notec2', ['../wp-content/themes/toolbox/js/assets/music/notec2.ogg','../wp-content/themes/toolbox/js/assets/music/notec2.mp3']);this.game.load.audio('noted2', ['../wp-content/themes/toolbox/js/assets/music/noted2.ogg','../wp-content/themes/toolbox/js/assets/music/noted2.mp3']);this.game.load.audio('notee2', ['../wp-content/themes/toolbox/js/assets/music/notee2.ogg','../wp-content/themes/toolbox/js/assets/music/notee2.mp3']);this.game.load.audio('noteg2', ['../wp-content/themes/toolbox/js/assets/music/noteg2.ogg','../wp-content/themes/toolbox/js/assets/music/noteg2.mp3']);this.game.load.audio('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 = game.add.audio('notec'); dkey = game.add.audio('noted'); ekey = game.add.audio('notee'); gkey = game.add.audio('noteg'); akey = game.add.audio('notea'); c2key = game.add.audio('notec'); d2key = game.add.audio('noted'); e2key = game.add.audio('notee'); g2key = game.add.audio('noteg'); a2key = game.add.audio('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) ckey.play(); if (randmusic == 2) dkey.play(); if (randmusic == 3) ekey.play(); if (randmusic == 4) gkey.play(); if (randmusic == 5) akey.play(); if (randmusic == 6) c2key.play(); if (randmusic == 7) d2key.play(); if (randmusic == 8) e2key.play(); if (randmusic == 9) g2key.play(); if (randmusic == 10) a2key.play(); } } },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 http://www.koanoftheday.com/trails, 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 = game.add.audio('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: http://www.html5gamedevs.com/topic/4104-font-problems/ Thank you all in advance.