EgorkZe

Members
  • Content count

    17
  • Joined

  • Last visited

About EgorkZe

  • Rank
    Member

Contact Methods

  • Twitter
    EgorkZe
  1. create() { this.game.physics.startSystem(Phaser.Physics.P2JS); this.game.physics.p2.gravity.y = 700; this.platformArray = []; this.startGame(); this.game.input.keyboard.onUpCallback = Level1.prototype.upCallback; } upCallback(e){ if(e.keyCode == Phaser.Keyboard.X){ this.player.endSlide(); //I can't get access here } } How to get access for player's method?
  2. EgorkZe

    How to offset for animation of sprite

    @valueerror i use starling sprite sheet( i haven't possibility to move images(
  3. Hi! I added some animations to sprite like this this.animations.add('run', Phaser.Animation.generateFrameNames('bunny_run', 0, 12, '', 4), 25, true); this.animations.add('jump', Phaser.Animation.generateFrameNames('bunny_jump', 0, 12, '', 4), 25, true); this.animations.add('slide', Phaser.Animation.generateFrameNames('bunny_slide', 0, 12, '', 4), 25, true); this.animations.add('death', Phaser.Animation.generateFrameNames('bunny_death', 0, 12, '', 4), 25, true); But the animation's frame for slide higher then other( How can i move the frame of animation?
  4. EgorkZe

    How to use offset for sprite's body

    Hmmmm, pivot is working! Nice!
  5. EgorkZe

    How to use offset for sprite's body

    @valuererror And what can i do to apply sprite's body offset? Help me
  6. EgorkZe

    How to use offset for sprite's body

    @rvizcaino I sure that i am using p2, because physic are working and objects are falling and colliding, but i can't use offset for the sprite's body(
  7. EgorkZe

    How to use offset for sprite's body

    @rvizcaino No, i enabled the physic engine like this: this.game.physics.startSystem(Phaser.Physics.P2JS); and enabled physic body : game.physics.p2.enable(this, true);
  8. EgorkZe

    How to use offset for sprite's body

    @rvizcaino Yes, of course GameObject extends Phaser.Sprite module BunnyRunner{ export class Player extends BunnyRunner.GameObject { constructor(game: Phaser.Game, x: number, y: number,width:number = 50, height:number = 50) { super(game,x,y,width,height,"bunnyAtlas"); this.body.fixedRotation = 1; this.animations.add('run', Phaser.Animation.generateFrameNames('bunny_run', 0, 12, '', 4), 25, true); this.animations.add('jump', Phaser.Animation.generateFrameNames('bunny_jump', 0, 12, '', 4), 25, true); this.animations.play('run'); this.body.offset.setTo(-200, -30); // it doesn't work this.body.onBeginContact.add(Player.prototype.checkCollision, this); }
  9. EgorkZe

    How to use offset for sprite's body

    @rvizcaino no, it doesn't help(
  10. Im trying do it like this: this.body.offset = new Phaser.Point(-20,-30); But it doesn't working( What am i doing wrong?
  11. EgorkZe

    onBeginContact with TypeScript

    With javascript i do it such way: body.onBeginContact.add(method,this); function method(body, shapeA, shapeB, equation){ ..... } How can i do it with TypeScript?
  12. EgorkZe

    How to disable collision for body

    this.body.data.shapes[0].sensor=true; this.body.data.gravityScale = 0; it doesn't work( but if i put only one string this.body.data.gravityScale = 0; it work It's a bug?
  13. EgorkZe

    How to disable collision for body

    @valueerror it doesn't work( "sprite.body.data.gravityScale = 0 ";
  14. EgorkZe

    How to disable collision for body

    How can i disable gravity for the sprite's body?
  15. EgorkZe

    How to disable collision for body

    But the body falling though the all objects. I want body not colliding only my hero body