• Content Count

  • Joined

  • Last visited

About MXPain

  • Rank
    Advanced Member

Contact Methods

  • Twitter
  1. Updated, added information shake plug-in creating
  2. Read here
  3. MXPain

    shake effect

    I'm glad that my theme lives, my final shake
  4. Our extension for painting in Flash – ‘Coloric’ is absolutely free for use!
  5. Hi guys, my new article here I hope it will be helpful.
  6. thanks, I fixed it in phaser.js endContactHandler: function (event) { this.onEndContact.dispatch(event.bodyA, event.bodyB, event.shapeA, event.shapeB, event.contactEquations); if (event.bodyA.parent) { event.bodyA.parent.onEndContact.dispatch(event.bodyB.parent, event.shapeA, event.shapeB, event.contactEquations); } if (event.bodyB.parent) { event.bodyB.parent.onEndContact.dispatch(event.bodyA.parent, event.shapeB, event.shapeA, event.contactEquations); } },
  7. Guys, onEndContact is still not working?
  8. Hi guys, what better way to add to BitmapData of sprite, contents of another sprite?
  9. here's a little bit of my final code for example) game.physics.p2.onBeginContact.add(this.collisionHandler, this);collisionHandler: function (bodyA, bodyB, shapeA, shapeB, contactEquations) { if(shapeA.material==null || shapeB.material==null)return; if("port" &&,5)=='enemy') { var spr = bodyB.parent.sprite; }}
  10. And that's not so, and that's how;) bodyA.parent.sprite
  11. Hi guys. How I can get Sprite object from bodyA or ShapeA ? collisionHandler: function (bodyA, bodyB, shapeA, shapeB, contactEquations)
  12. I removed you have a property - sensor and it worked, it turns out it does not work with sensors? I need to object flew across the border(
  13. Hi guys, I have not worked ImpactEvents handler prompt in what may be the case: for(var i=0; i<enemies.length; i++) { for(var j=0; j<borders.length; j++) { enemies[i].body.createBodyCallback(borders[j], this.hitEnemy, this); } } game.physics.p2.setImpactEvents(true); hitEnemy: function(body1, body2) { console.log('collide borders with enemy'); },
  14. Hi guys. Object does not collide with the boundaries of the world in my mobile project. Please tell me what could be the case, for example, I wrote a short code, but the sprite passes through the boundaries of the world without collide with them. /** * Created by Buggy on 14.08.14. */var hero;var cursors;BasicGame.GameTest = function (game) { // When a State is added to Phaser it automatically has the following properties set on it, even if they already exist:; // a reference to the currently running game this.add; // used to add sprites, text, groups, etc; // a reference to the game camera this.cache; // the game cache this.input; // the global input manager (you can access this.input.keyboard, this.input.mouse, as well from it) this.load; // for preloading assets this.math; // lots of useful common math operations this.sound; // the sound manager - add a sound, play one, set-up markers, etc this.stage; // the game stage this.time; // the clock this.tweens; // the tween manager this.state; // the state manager; // the game world this.particles; // the particle manager this.physics; // the physics manager this.rnd; // the repeatable random number generator};BasicGame.GameTest.prototype = { create: function () { var back = this.add.sprite(0, 0, 'game', 'back.png'); this.physics.startSystem(Phaser.Physics.P2JS); this.physics.p2.restitution = 0.8; hero = this.add.sprite(200, 200, 'game'); hero.anchor.setTo(0.5, 0.5); hero.pivot.y = 10; hero.animations.add('idle', Phaser.Animation.generateFrameNames('tomato_idle/', 0, 11, '', 4), 15, true);'idle'); // Create our physics body. A circle assigned the playerCollisionGroup game.physics.p2.enable(hero); // This boolean controls if the player should collide with the world bounds or not hero.body.collideWorldBounds = true; cursors = game.input.keyboard.createCursorKeys(); }, update: function () { hero.body.setZeroVelocity(); if (cursors.left.isDown) { hero.body.moveLeft(200); } else if (cursors.right.isDown) { hero.body.moveRight(200); } if (cursors.up.isDown) { hero.body.moveUp(200); } else if (cursors.down.isDown) { hero.body.moveDown(200); } }};
  15. MXPain

    p2 Contact impulse

    Thanks all, here is my resulting code, I decided to check the speed at the moment of impact: collisionHandlerHero: function (body, shapeA, shapeB, equation) { if(equation[0]!=null) { var res = Phaser.Point.distance(new Phaser.Point(equation[0].bodyB.velocity[0],equation[0].bodyB.velocity[1]), new Phaser.Point(0,0)); console.log(res); }}