yegorf1

Members
  • Content Count

    18
  • Joined

  • Last visited

  1. Actually, this topic not about Phaser. Just want to now how to exit form my cocoonjs app. I tried to close app via function exit() { window.open(window.location, '_self').close();}But it doesn't work. Any ideas?
  2. After looking on Phaser source, I found solution: whatever.body.data.velocity[0] *= 0.99;whatever.body.data.velocity[1] *= 0.99;
  3. No, I setting velocity to move.
  4. Holla, amigos! How to slow moving of bodies in P2 physics? I need to substrat 1 pts from body speed per second.
  5. Here again. My circles are ignoring world bounds. So there is code: this.game.world.setBounds(0, 0, WINDOW_WIDTH, WINDOW_HEIGHT);this.game.physics.startSystem(Phaser.Physics.P2JS);this.game.physics.p2.restitution = 0.8;this.game.physics.p2.updateBoundsCollisionGroup();//...////...////...//chipsCollisionGroup = this.game.physics.p2.createCollisionGroup();this.chips = this.game.add.group();this.chips.enableBody = true;this.chips.physicsBodyType = Phaser.Physics.P2JS;//...////...////...//function setupChip(chip, owner, game) { if (chipsCount[owner] < 1) return false; var MAX_MASS = 6; var mass = Math.ceil(Math.random() * (MAX_MASS - 1)) + 1; chip.scale.setTo(convertY(CHIP_SIZE / MAX_MASS * mass) / 64); chip.mass = mass * 100; chip.anchor.setTo(0.5, 0.5); chip.tint = PLAYERS_COLORS[owner]; chip.owner = owner; chip.dragging = false; chip.body.setCollisionGroup(chipsCollisionGroup); chip.body.collides(chipsCollisionGroup); chip.body.setCircle(chip.width / 2); chip.inputEnabled = true; chip.input.start(0, true); chip.events.onInputDown.add(drag); chip.events.onInputUp.add(stopDrag); return true;}//Usally previous function calls like thisvar chip = state.chips.create(WINDOW_WIDTH / 2, WINDOW_HEIGHT / 2, 'chip');setupChip(chip, PLAYER_FIRST, state.game);
  6. yegorf1

    Circle physics

    Again did it by myself: if (isInBounds(BOUNDS[chip.owner], chip.y)) { if (frame % 5 == 0) { chip.oldPos = { x: chip.x, y: chip.y }; } chip.body.velocity.x = 10 * (chip.pointer.worldX - chip.x); chip.body.velocity.y = 10 * (chip.pointer.worldY - chip.y);} else { stopDrag(chip, chip.pointer);}
  7. yegorf1

    Circle physics

    Yep, thanks for all this. I already found it, but forgot to write here. And now I have problem when I'm trying to drag chip. For that, I need to kill it and reset - I think it's slow and not right way.
  8. yegorf1

    Circle physics

    I didn't find how to make circle and collige group with itself.
  9. yegorf1

    Circle physics

    Tried to use Ninja physics, but can't collide group with itself and can't remove gravity.
  10. yegorf1

    Circle physics

    Hello! I tried to make my game with physics. Prototype you can find here. First goes blue, than red, green, yellow. You can't win or lose, yet. As you can see, I use circles, but I use Phaser.Physics.ARCADE too and it doesn't support circles, so now there're squares instead of circles. How can I fix it? .Sorry for bad english
  11. yegorf1

    Dotted line

    Oh. Okay. I found mistake. Need change bmd = this.game.add.bitmapData(800,600); to bmd = this.game.add.bitmapData(WINDOW_WIDTH, WINDOW_HEIGHT);
  12. yegorf1

    Dotted line

    I tried your code, but have issues. So, this is my code: var WINDOW_WIDTH = window.innerWidth || document.documentElement.clientWidth || document.getElementsByTagName('body')[0].clientWidth, WINDOW_HEIGHT = window.innerHeight || document.documentElement.clientHeight || document.getElementsByTagName('body')[0].clientHeight;function convertX(x) { return WINDOW_WIDTH * x;}function convertY(y) { return WINDOW_HEIGHT * y;}///bmd = this.game.add.bitmapData(800,600); bmd.ctx.beginPath();bmd.ctx.lineWidth = "2";bmd.ctx.strokeStyle = 'white';bmd.ctx.setLineDash([5, 6]);bmd.ctx.moveTo(0, convertY(0.5));bmd.ctx.lineTo(convertX(1), convertY(0.5));bmd.ctx.stroke();bmd.ctx.closePath();this.game.add.sprite(0, 0, bmd);But line isn't needed lenght, as you can see here. Any ideas?
  13. yegorf1

    Dotted line

    As I see, easier and faster to use sprite?
  14. yegorf1

    Dotted line

    Hi again! Is there any way to draw dotted line, except sprite and many small lines?
  15. Thanks again.