Search the Community

Showing results for tags 'phaser2'.

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 3
    • Phaser 2
    • 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 17 results

  1. CodePen I feel confusing when i use Tween.from. Using Tween.from without repeat param the animation shows correctly.It move from (100,0) to (0,0).But when i use Tween.from with repeat param. The repeat is from (0,0) to (100,0).Why?I think it would repeat always from (100,0) to (0,0)
  2. Hey, So I am working on a car game and I have 1 issue with the speed at which car drops. My friend who owns a IPhone s6 complains that on his device the cars drop too fast, while on my Samsung s7 edge the car seems to drop slow enough. I dont know what might cause it. My obstacle velocity is set to 1200; // OBSTACLES vars var obstacleSpeed = 1200; var obstacleDelay = 400; var platforms; var score; And this is my Loop + update function // OBSTACLES OF THE CAR, function(){ var obstacleSpeed = 1200; var obstacleDelay = 400; for(var i = 0; i < 1; i++){ if(game.rnd.between(0, 1) == 1){ var obstacle = new Obstacle(game, i); obstacle.scale.setTo(scaleRatio, scaleRatio); game.add.existing(obstacle); obstacleGroup.add(obstacle); } } }); // Game on touch move car game.input.onTap.add(function() { if (game.input.x < w / 2 ){ if( canMove && goleftonce == 2 || goleftonce == 1) { canMove = false; goleftonce++; gorightonce--; game.add.tween(car).to({ angle: -30}, 100, Phaser.Easing.Linear.None, true).onComplete.addOnce(function(){ game.add.tween(car).to({ angle: 0}, 100, Phaser.Easing.Linear.None, true); canMove = true; }, this); game.add.tween(car).to({x: car.x - w/3}, 100, Phaser.Easing.Linear.None, true); } } else { if( canMove && gorightonce == 2 || gorightonce == 1) { canMove = false; goleftonce--; gorightonce++; game.add.tween(car).to({ angle: 30}, 100, Phaser.Easing.Linear.None, true).onComplete.addOnce(function(){ game.add.tween(car).to({ angle: 0}, 100, Phaser.Easing.Linear.None, true); canMove = true; }, this); game.add.tween(car).to({x: car.x + w/3}, 100, Phaser.Easing.Linear.None, true); } } }); }, update: function() { // Collide the car and with the obstacles aka other cars game.physics.arcade.collide(car, obstacleGroup, function(){ canMove = true; countcars = 0; goleftonce = 2; gorightonce = 2; game.state.start('gameover'); }); } } // Position where the obstacle spawns Obstacle = function (game) { var position = game.rnd.between(0, 2);, game, (w/3) * position + 130 , 0, "obstacle"); game.physics.enable(this, Phaser.Physics.ARCADE); }; Obstacle.prototype = Object.create(Phaser.Sprite.prototype); Obstacle.prototype.constructor = Obstacle; Obstacle.prototype.update = function() { this.body.velocity.y = obstacleSpeed; if(this.y > game.height){ countcars++; score.setText("Score: " + countcars); this.destroy(); } };
  3. I am learning Phaser CE API and i cannot understand the param `alphaThreshold` in the method enableDrag. Anybody can tell me how to use it correctly?

    Hello, I am at my first game ever and I choose phaser2, latest CE version. Basically I have 3 lanes and I am trying to spawn cars on these lanes, and the player must avoid crashing into them. The game orientation I choose is portrait. I have a few questions that maybe you guys can help me with, if you are willing of course 1. I am using the default Phaser arcade Physics. Should I choose something else? I am unhappy with the collision point between the cars at the moment. 2. On Iphones and tablets I have issues with the scaling. The collision between cars is huge (I am talking about the area of collison). I have this in the index.html <meta name="viewport" content="width=device-width, initial-scale=1"> Then I am using this in my main js. scaleRatio = window.devicePixelRatio / 3; // Get device sizes var w = window.innerWidth * window.devicePixelRatio; var h = window.innerHeight * window.devicePixelRatio; var game = new Phaser.Game(w, h, Phaser.CANVAS, '', { init: init, preload: preload, create: create, update: update, render: render }); function init() { // make the game occuppy all available space, but respecting // aspect ratio – with letterboxing if needed = Phaser.ScaleManager.SHOW_ALL; = true; = true; = '100%'; = '100%';; } // Creating the car car =; // We will enable physics for any object that is created in this group car.enableBody = true; // Designate the car sprite to the VAR car car = game.add.sprite(0 , 0, 'car'); car.anchor.set(0.5); car.scale.setTo(scaleRatio, scaleRatio); game.physics.arcade.enable(car); car.x =; car.y = - car.height; // car.body.collideWorldBounds = true; // car.checkWorldBounds = true; // car.body.bounce.setTo(car.x + w/3, 0); // OBSTACLES obstacleGroup =; obstacleGroup.enableBody = true; obstacleGroup.scale.setTo(scaleRatio, scaleRatio); This would be it from now. If you can pinpoint me to some articles that can help me with my car game or have any advices I would be happy to hear them. Thanks,
  5. How to smooth tween animation

    How to smooth the tween animation in the android devices.
  6. Hey all, I'm using tween for my game in the android device it is too lacking and slowly working tween, then i tried with physics both too slow how to solve.
  7. How to detect if tab is not active

    How to detect if current window tab is not active in the phaser
  8. Huntin and Fishin

    This is something I put together this afternoon for my students to play with. Live demo.
  9. Sprites are overlapping on collide

    Hello, Im making a game where you have to jump some cars, you only lose if you touch the left side of a car. the problem is when the character lands over a car both sprites overlap, and if another car comes behind you will collide with it instead of pass over it I'm using arcade physics. I'll let you a couple screenshoots of this. Is there some way to avoid this?
  10. how to make number tiles

    How to make number tiles with colors for example: array[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]; I need to show into these box
  11. Hello! I am trying to make a player to collide with the ground. But the ground has been imported from a tilemap using the tiled program. The collision is not working This is the important part of my code: collisionLayer = map.createStaticLayer('collisionLayer', tileset); var players = findObjectsByType('player', map, 'objectsLayer'); player = this.physics.add.sprite(players[0].x, players[0].y, 'dude'); this.physics.add.collider(player, collisionLayer); findObjectsByType is not a phaser native method, but it is working. The code runs without errors, but the collision is not working. I have attached the code. Thanks!
  12. Hey I am planning to create web game pages by using Phaser2. My project will be used Phaser2, Java, jsp and Oracle DB (maybe Node.js) I want to make this game Multiplayable, so I decide to get web hosting service but I can't find proper hosting service site. What is the proper hosting site in my project conditions??
  13. Touch screen problem in Kongregate

    Hi, I just uploaded a game made with on Kongregate to its own server (using the option webgl/html5): In the game I use the onDown event: game.input.onDown.add (this.myfunction, this); In the free server where I have it hosted everything works correctly: The problem is that on touch screens and only on the Kongregate website, raising your finger generates the onDown event. Due to this the control becomes very difficult in touch screens. From what I see the game is embeded in an iframe from one of its servers. I would like to avoid the use of onTap, since it is not very agile for this type of game. Has anyone else had this issue? Any advice?. Thanks in advance. Regards.
  14. I am new to Phaser development and I am currently having trouble figuring out the correct code needed to have a game resize to the full viewport of a browser on window resize without stretching any of the graphics. I am working on a vertical scroller with a tilemap (1024x4608) for the base background/map. On window resize (or orientation change) I would like to be able to adjust the game dimensions to fill up the entire viewport while keeping the same ratio to allow the tilemap not to be distorted. From my tests, it seems that I would want to keep the width the same and adjust the height then let the game scaling do its thing to allow the game to take up the full browser viewport without stretching the tilemap. I just have not been able to figure out the correct ScaleManager settings to make that happen. I tried the following which does scale the game but does not adjust the width/height to take up the whole viewport: Game instantiation: var gameHeight = window.innerHeight * 1024 / window.innerWidth;var game = new Phaser.Game(1024, gameHeight, Phaser.CANVAS, 'test-game');In the window resize function: game.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL;game.scale.pageAlignHorizontally = true;game.scale.pageAlignVertically = true;game.scale.setScreenSize();game.scale.refresh();And this attempt takes up the whole viewport but does not scale correctly so it stretches the tilemap: In the window resize function: game.scale.setMaximum();game.scale.refresh();Any help would be greatly appreciated.
  15. Hello. I'm using the following code to make my game responsive: = Phaser.ScaleManager.SHOW_ALL;; = true; = true;;But it only change the size if I refresh the page... Is it possible to change when window resize? I saw that in early versions (for example 1.1.3) it resized when the window resized..
  16. Hi all, I noticed that input isn't working on stock Android ( namely older devices like the Nexus S ). It seems officially touch events aren't supposed to work - using mouse instead, and Chrome's device emulation confirms that. This can be fixed by checking if the device is touch in the Phaser Mouse start function: if ( && === false && this fixes it in Chrome, but it's still not working on the device. I've tried a bunch of things, but even the touch and mouse events aren't triggering. We've previously built a game on Phaser 1.1.6 and everything works correctly on the same device. Anyone have any ideas? Even an idea on how to debug this besides console logging would be useful. Thanks, David Goemans Lead game dev @ Boostermedia
  17. how to scale game to fit browser window in Phaser 2.x ?