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

  1. Stopping Timer in Phaser

    Basically I'm making a basic racing game where I have the timer start at the beginning of the game, but I can't get it to stop when the racecar collides with the finish line. Any help would be appreciated.
  2. Phaser Update Speed

    Hi there, I am currently using phaser for a simulation of life evolving a neural network inside little creatures. This relies on generation after generation of these creatures being evolved with a genetic algorithm. I am currently relying on the arcade physics system to handle collisions and overlaps etc, and the little creatures survive by eating food, and hunting each other. Or at least that is what they should learn to do. Currently each round last 45 seconds, this in itself isn't a problem, but I have been trying to find a way to step the Phaser engine at the fastest speed possible so that I can complete a number of simulations in the shortest possible time. It can take 1000s of generations before the creatures evolve to show intelligent behaviour. I am struggling to achieve this at present. I have tried using game.enableStep() and then in the update function calling game.step() more than once but this doesn't appear to work. Does anyone know how I can do this? Thanks for you help. ps. I have made a little site showcasing the neural network I plan to add more examples and will put the code up on Github soon. Its the sort of thing that will be really handy for creating AI for games.
  3. goomba move

    Hi everyone, I want to move my enemy like this For the moment i use: function create_enemy() { APP.enemy =; tabEnemy = []; tabEnemy[0] = APP.enemy.create(2477, 1938, 'enemy'); tabEnemy[1] = APP.enemy.create(2813, 1842, 'enemy'); tabEnemy[2] = APP.enemy.create(3019, 1746, 'enemy'); tabEnemy[3] = APP.enemy.create(3551, 1650, 'enemy'); for (var i = 0; i < tabEnemy.length; i++) { game.physics.enable(tabEnemy[i]); }};function update_enemy() { game.physics.arcade.collide(APP.layer, APP.enemy); //enemy1 if (bow(tabEnemy[0].position.x) == bow(2477)) { tabEnemy[0].body.velocity.x = -100; }; if (bow(tabEnemy[0].position.x) == bow(1968)) { tabEnemy[0].body.velocity.x = 100; }; //enemy2 if (bow(tabEnemy[1].position.x) == bow(2813)) { tabEnemy[1].body.velocity.x = -100; }; if (bow(tabEnemy[1].position.x) == bow(2694)) { tabEnemy[1].body.velocity.x = 100; }; //enemy3 if(bow(tabEnemy[2].position.x) == bow(3200)) { tabEnemy[2].body.velocity.x = -100; }; if(bow(tabEnemy[2].position.x) == bow(3019)) { tabEnemy[2].body.velocity.x = 100; }; //enemy4 if(bow(tabEnemy[3].position.x) == bow(3551)) { tabEnemy[3].body.velocity.x = 100; }; if(bow(tabEnemy[3].position.x) == bow(3773)) { tabEnemy[3].body.velocity.x = -100; };};function bow(value){ var calcul = Math.ceil(value / 10) *10; return calcul;}Do you have a better way to do it ? Thank you.
  4. Antivirus software blocking Phaser

    I have gotten complaints from attempted players of my games that their antivirus software (Avast!) is blocking the phaser-build game. Is anybody else having similar problems? What can I do about it? edit: bitdefender blocks it too
  5. Game won't load (newbie)

    Hi, I recently decided to have a go at making a game (a very simple one) and have run into an error and I am now unsure what to do. I'm using version 2.0.5 and the error I get is 'TypeError: h is undefined' (In firebug it says the error is coming from phaser.min.js) My game is split into states (load, game, menu, level) I've pasted my level code into JSFiddle Thank you for any help and if you need more info then I'll provide it.
  6. Performance Tips

    Hello everyone. This is my first time posting on the HTML5 Game Dev forums so don't hurt me. I am currently working on a small project for a job that I got about a month ago. We are using the Phaser engine to create three games in one app. Two of the games use Phaser's Arcade Physics the third does not. We wanted these games to be available on both the App Store (iOS) and the Play Store (Android) so we decided to go with PhoneGap to wrap our games. Our first few attempts were with CocoonJS and that didn't work out too well for us. So in short, right now we are at the stage where we can get PhoneGap to give us a working app that we can put on an Android phone for testing. We have tested our app with three different phones right now ranging from old, to decent to pretty much brand new. The phones are as follow: HTC Desire C HTC One V Samsung Galaxy S4 MiniThe games run fine on the S4 Mini with a couple blips in the frame rate here and there but on the other two devices they just run horribly. Unfortunately we haven't had the opportunity to test on other physical devices just yet. Through some research we saw some posts stating that devices pre-2012 don't run JavaScript that well. This would explain the first two devices but not so much about why there are frame rate blips on the S4 Mini. I realize the easiest thing to look at is how the code is written but we ran a test app on its own on the first two phones. This app simply has a tween that goes off once every 6 seconds tweening in 6 colored boxes. The only other thing is there is an event listener for a tap on the boxes. If anyone can shed some light on the issue, that would be greatly appreciated!
  7. Hi guys, Today I'm trying to get my game running in CocoonJS, the game does work perfectly in a normal desktop and mobile browsers, but I'm getting some errors in CocoonJS. The error says: Javascript Exception (Tag: 'load'): Error: Phaser.Loader. Invalid XML given at e.Loader.xmlLoadComplete(js/min/phaser.min.js:12:9823) at XMLHttpRequest.i.xmlURL._xhr.onload (js/min/phaser.min.js:12:7414) It's my first time using CocoonJS so I have no idea where the error is coming from, but it is coming from Phaser.js itself. Any ideas?
  8. Gradient background

    I am a total beginner with phaser and graphics programming so pardon my newbness. I am trying to do something similar to game.stage.backgroundColor only I want backgroundGradient. The only gradient methods seem to be for BitmapData however. Furthermore I can't even get any BitmapData to render. I just want to make my stage have a background gradient. Can somebody help me? Thanks! P.S. I have looked at this similar phaser post but couldn't make the canvas example work.
  9. Water. Slowdown in P2 physic

    How do I desired deceleration of the object in motion? Suppose when the object is in the water acts on it slowing. I tried to do velocity * 0.99. Slowing down there, but got out a lot of bugs. Now do so:this.obj.rotation = game.physics.arcade.moveToXY(this.obj, this.pointer.x, this.pointer.y, this.speed, 200);How do I make braking object? I've already rummaged
  10. How to identify button click from array of buttons?
  11. [ASK][PASHER]bounce sprite

    how i can make image bounce in center place? var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render }); function preload() { game.load.image('flyer', 'assets/sprites/phaser-dude.png'); } var image; function create() { game.physics.startSystem(Phaser.Physics.ARCADE); image = game.add.sprite(0, 0, 'flyer'); game.physics.enable(image, Phaser.Physics.ARCADE); image.body.velocity.setTo(200,200); image.body.collideWorldBounds = true; image.body.bounce.set(1); } function update () { } function render () { game.debug.spriteInfo(image,32,32); }
  12. Hey guys jg here, So I recently stumbled across PhaserJS and found some cool youtube tutorial videos and documentation online. I've managed to display my sprite on the canvas. I wanted to get it to drop down so I set the sprites velocity.y = 100; But it's not moving. Can someone tell me what's wrong with my code? var star;var game = new Phaser.Game(800, 600, Phaser.AUTO, '', { preload: preload, create: create, update: update });function preload(){ game.load.image('star','star.jpg'); } function create(){ star = game.add.sprite(,0,'star'); star.velocity.y = 100; } function update(){ }
  13. I want to touch a sprite hold it and drag it to a new point and then release it. How do I implement this? I tried the following code. sprite.inputEnabled = true;sprite.input.start(0, true);sprite.input.enableDrag(false, true, true);It is working perfectly using mouse on desktop but on mobile, first i have to touch the sprite then touch on another position to move the sprite there(No dragging and dropping is done here). I want to touch the sprite to pick it up and without releasing I want to drag and move it to a new position. Please help. Thanks
  14. i want to disable button after clicking to prevent double-click and enabled again after specific time ? how i can do it ?
  15. So i'm trying to crop an image and it isnt working - i keep getting Uncaught Error: Texture Error: frame does not fit inside the base Texture dimensions [object Object] But this isnt making sense to me because this is how making the rectangle: var currentHeart: Phaser.Image = this.heartFills[i][this.heartFills[i].length - 1]; this.cropRects[i] = new Phaser.Rectangle(currentHeart.x,currentHeart.y, currentHeart.width-10,currentHeart.height-10); currentHeart.crop(this.cropRects[i]); currentHeart.position.y = 56 - currentHeart.height;Literally telling it "just go 10 pixels smaller than the image itself in both directions". My end goal is to the x be currentHeart.x and my y be a fraction of the height based on the players health, but right now I can;t get it to crop and i dont understand why.
  16. Hi! I have researched how to integrate the Google Play Games with our javascript games, and found nothing. Any of you have a idea how to do it? P.S.: After I see the CocoonJS demo, I see that is possible, but, how to do it?
  17. Hey guys, I'm having some issues switching between states. In the first run it all works fine, but then when I come back to a state I've already been at, like MainMenu, the design is all messed up. I think it is because not all sprites and stuff are removed when I switch states, that's why I added a in my shutdown function. However that doesn't seem to do anything. Is there another short way to delete everything (except cache) from a state before switching to another state, or does it have to be done manually? I've attached 2 images, one of my MainMenu first time, and one of the MainMenu when I switch back to it (after the Game). Excuse me if it is a silly question, I've just recently started using states.. Thanks, Kevin
  18. [closed]phaser lock body axis

    Is there a simple way to lock the x or y axis of a p2js body? I ask because I need to keep a group of objects within columns, I'm hoping I can avoid creating new column-gutter sprites just to separate the columns.
  19. debug p2js physics

    when i switch to p2js I can't seem to debug physics at all (I dont see any overlays). So here is what i am doing oncreate this.pandas =, 'pandas', false, true, Phaser.Physics.P2JS); this.pandas.createMultiple(28, 'panda');onupdate at certain intervals I fetch a panda! var panda = this.pandas.getFirstExists(false); if (!panda) { return; }...panda.reset(x, y);panda.debug = true;render this.pandas.forEachAlive(function(panda) { game.debug.body(panda); });
  20. Following Multiple Sprites

    A friend and I are working on a platformer-fighting game using the Phaser framework and are wondering if there is anyway built in function to keep multiple sprites on the screen at the same time? We want it so that we can zoom in to the players if they are all next to each other but for the camera to zoom out if they separate (kinda like super smash bros melee).
  21. Hi everybody ! Here is the 2nd game I made with Phaser : Candy Mirror Ninja ! The originality is that you don't see things as they are, you only see the images of them on mirrors which are the walls of the levels. You will need some time to get used to it, it's a bit special to master. Controls : Use the arrows to move the Ninja and the mouse to aim and shoot when you get the Laser. Information : The game is based on the themes of the Global Game Jam 2014 ("We don't see things as they are, we see them as we are") and the Candy Jam.It's why there is a King which protects the Candy from you. He shoots avocados (because the french for avocado is also the name for lawyer, little joke ^^) in each direction, faster if you get closer to the Candy. These avocados can kill you.Finally, you can get a Laser to shoot at the King or mirrors to make reflections. Notes : The game uses masks for the mirror images, so it requires WebGL.The game doesn't work on Internet Explorer.Firefox doesn't render well the texts.You need to activate WebGL in Safari.Chrome is the best browser for this game. >> The link of the game on : << >> The source on GitHub : << Hope you have fun even if it's a little difficult and a bit ugly ^^ Let me know what you think of it !
  22. Hi, I'm making a simple game with Phaser I have a spritesheet with two frames. I need an animation of sprite disappear, frame change and appear again like .to( {x:0, y:0 }, 600, Phaser.Easing.Bounce.Out); .frame = 1; .to( {x:1, y:1 }, 600, Phaser.Easing.Bounce.Out); How do i connect it into one chain? Thanks,
  23. I have a scene where blocks fall from the sky onto the ground. As they do, they stack up thanks to collision separation. I noticed however that after the stack reaches a height of two or three blocks the incoming block somehow forces blocks at the bottom to lose their separation. I want to stop that from happening. If two blocks collide they should remain separated. I am using the arcade physics, (hope that's not the problem). here is the code window.onload = function() { 'use strict'; var state = { lastCheckin: 0, pandas: null, preload: function () { game.load.image('panda', 'assets/panda.png'); }, loadUpdate: function () { }, loadRender: function () { }, create: function () { game.physics.startSystem(Phaser.Physics.ARCADE); this.pandas =; }, update: function () { game.physics.arcade.collide(this.pandas, this.pandas); var now =, delta = now - this.lastCheckin; if (delta > 1000) { this.lastCheckin = now; var panda = game.add.sprite(Math.random() *, 0, 'panda'); this.pandas.add(panda); game.physics.arcade.enable(panda); panda.body.gravity.y = 500; panda.body.collideWorldBounds = true; } }, render: function () { }, paused: function () { }, pauseUpdate: function () { }, shutdown: function () { } } var game = new Phaser.Game(320, 480, null, null, state);};
  24. LeapJS with Phaser?

    Newbie here. Making a game/installation with phaser and was wondering if I can use leapjs with phaser? Any advice would be appreciated. Thanks! JW
  25. Hello there! This is my first game with the Phaser framework, also the first game i released in public. I'm trying to work with the mindset of . The reason is that i always try to make games, spending all my time changing and adding new things and the result was me being bored with the game and never completing it. Now, i was "forced" to finish the game and it worked much better than before! I know this is a bad game, not much content, bad art, But hey! I'm still learning! The game is a simple space shooter (What an awesome game title! Right? ) Your ship follows the mouse pointer and shoots automatically when an enemy is seen. Take the " ? " boxes for power ups! You can upgrade your weapon in the shop with the credits you earn each fight! Stay alive long enough to fight the boss! You can play it here: You can find the source code here: Any comment,suggestion, improvement or bug report is welcome!