• Content count

  • Joined

  • Last visited

About Puflo

  • Rank

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Puflo

    Error happens after state restart

    Sorry for late response. That fixed the problem.
  2. Puflo

    Error happens after state restart

    No, scaleSignal is assigned before tileLayer. This error only happens after restart even if i don't resize the game.
  3. I have 2 states: Game and Idle, i switch state to Idle everytime player disconnects from the server, and state is switched to Game when player connects to a server. I get this error after restarting game state without refreshing the page: This SignalBinding causes the error this.scaleSignal = this.scale.onSizeChange.add(function(scaleObject, width, height){ if (this.map && this.collisionLayer && this.tileLayer){ this.collisionLayer.resize(width, height); this.tileLayer.resize(width, height); this.tileLayer.resizeWorld(); } }, this); I have this shutdown function to prevent it, but the error still occurs. shutdown(){ console.log('Game state is shutting down'); this.scaleSignal.detach(); } Why is this happening and how can i fix it?
  4. Is it possible to check if sprite is a circle or not without manually specifying it?
  5. Puflo

    State shutdown event

    How can I call a function when Game state is shutting down? To be more specific, I want to close a connection when the game is switching to another state.
  6. Puflo

    Phaser examples license

    Is sprites/sounds in phaser examples site free to use for commercial projects?
  7. Puflo

    Monetizing a web game

    I made a multiplayer HTML5 game for web browsers but i have no idea how to monetize it. I don't have a google adsense account and I don't think they'd accept my game with low (20-30) amount of players, i can't afford server prices without ads. Any suggestions are welcome. (except sites that show popup ads or only has paypal as payment method)
  8. Puflo

    Need cordova plugin

    I need to add google play games to my game, which cordova plugin would you recommend?
  9. Puflo

    Physics bug

    I can't get ship2 and ship3 to collide world bounds, what i'm doing wrong? They collide each other but only ship1 is colliding world bounds. ship1 = game.add.sprite(200, 300, 'ship'); game.physics.box2d.enable(ship1); ship1.body.setCircle(14); ship1.body.setCollisionCategory(1); ship2 = game.add.sprite(200, 200, 'ship'); game.physics.box2d.enable(ship2); ship2.body.setCircle(14); ship2.body.setCollisionCategory(2); ship2.body.setCollisionMask(3); ship3 = game.add.sprite(300, 200, 'ship'); game.physics.box2d.enable(ship3); ship3.body.setCircle(14); ship3.body.setCollisionCategory(2); ship3.body.setCollisionMask(3); game.physics.box2d.setBoundsToWorld(true, true, true, true, 1, 3); // or 2,3 Edit: I made a hotfix for this, but i'd like to know why is the example above isn't working. game.physics.box2d.setBoundsToWorld(true, true, true, true); for (var i in game.physics.box2d.walls){ game.physics.box2d.walls[i].setCollisionCategory(2); game.physics.box2d.walls[i].setCollisionMask(3); }
  10. Puflo

    Programming a ladder

    Not sure but i think you can do something like this: // update function var currentTile = map.getTile(mapLayer.getTileX(player.body.x), mapLayer.getTileY(player.body.y), mapLayer); if (currentTile.properties.isLadder && cursors.up.isDown){ player.body.velocity.y = -200; }
  11. Puflo

    Physics bug

    What exactly is 2 + 4 and why is collision mask 4 colliding with ship 2?
  12. Puflo

    Physics bug

    Box2D always calls contact callback twice. Here's an example: Ship with collision category 2 (ship at left) calls contact callback once while ship with collision category 1 (default) calls it twice. I've been trying to fix this for weeks but couldn't find any solution in web, i really need you guys to help me. function create() { game.physics.startSystem(Phaser.Physics.BOX2D); game.stage.backgroundColor = '#2d2d2d'; // User-controlled ship ship1 = game.add.sprite(250, 300, 'ship'); game.physics.box2d.enable(ship1); ship1.body.setCircle(14); // Ship with collision category 2 (triggers contact callback only once, it shouldn't even trigger it) ship2 = game.add.sprite(200, 200, 'ship'); game.physics.box2d.enable(ship2); ship2.body.setCircle(14); ship2.body.setCollisionCategory(2); // Ship with collision category 1 *default, i guess* (triggers contact callback TWICE) ship3 = game.add.sprite(300, 200, 'ship'); game.physics.box2d.enable(ship3); ship3.body.setCircle(14); game.physics.box2d.setBoundsToWorld(true, true, true, true, false); ship1.body.setCategoryContactCallback(1, function(b1,b2,f1,f2,begin){ if (begin){ total += 1; hitText.text = 'Contact callback called '+total+' times'; console.log("CONTACT: ", b2) } }, this); cursors = game.input.keyboard.createCursorKeys(); game.add.text(5, 5, 'Use arrow keys to move.', { fill: '#ffffff', font: '14pt Arial' }); total = 0; hitText = game.add.text(5, 30, 'Contact callback called 0 times', { fill: '#ffffff', font: '14pt Arial' }); } function update() { if (cursors.left.isDown) { ship1.body.rotateLeft(300); } else if (cursors.right.isDown) { ship1.body.rotateRight(300); } else { ship1.body.setZeroRotation(); } if (cursors.up.isDown) { ship1.body.thrust(300); } else if (cursors.down.isDown) { ship1.body.reverse(300); } } function render() { game.debug.box2dWorld(); }
  13. Puflo

    Drawing a haxball-like ball in phaser

    Okay, i have a little question; how can i draw a colored circle with bitmapdata? Couldn't find anything in examples.
  14. Puflo

    Drawing a haxball-like ball in phaser

    What is the difference between bitmapText, text and graphics, bitmapData? Which one should i use for mobile games?
  15. I want to create a ball inside a circle line, is there any way to do this in Phaser?