• Content Count

  • Joined

  • Last visited

About maxpower

  • Rank

Profile Information

  • Gender
    Not Telling
  • Location
    Brisbane, Australia
  1. Hey everyone, I'm creating a snake like game using p2 physics, I'm using body.setCircle() for collision. Each part of the snakes tail is using setCircle() but they are not acting as one. For example if one part of the snakes tail gets hit only that part moves not the whole snake. Is there a way so group collision objects so that act as one? Thanks
  2. Hey guys I'm trying to get a function to be called each time the gamepad is released. I think I need to use the function addCallbacks() and the property onUpCallback from the Gamepad class. I have Gamepad called pad1 and a function test() that should be called every time any gamepad button is released, but not really sure how callbacks work/correct syntax. Thanks for your help.
  3. Okay so casting worked fine, getChildAt() doesn't actually return a sprite. var test = <Object> this.objectsGroup.getChildAt(i); test.destroy();
  4. Hey Guys, I'm using typescript in visual studio for web and can't access the sprite methods when using though group call getChildAt() e.g this.objectsGroup.getChildAt(i).destroy(); This is the error I get Error 1 Build: Property 'destroy' does not exist on type 'DisplayObject'. Not sure if i'm meant to cast this? Any help would be much appreciated class below. module Test { export class Level1 extends Phaser.State { background: Phaser.Sprite; crossHairGroup: Phaser.Group; poleGroup: Phaser.Group; objectsGroup: Phaser.Group; crossHair: CrossHair; pole: Phaser.Sprite; object: Phaser.Sprite; create() { this.crossHairGroup =; this.poleGroup =; this.objectsGroup =; this.background =,, 'background'); this.background.anchor.setTo(0.5, 0.5); this.crossHair = new CrossHair(,,, this.crossHairGroup); this.initializeObjects();, this); } fire() { var bullet =; /* Check if bullet hits object */ for (var i = 0; i < this.objectsGroup.length; i++) { if (this.checkOverlap(this.objectsGroup.getChildAt(i), bullet)) { this.objectsGroup.add(this.object); /* this line not working */ //this.objectsGroup.getChildAt(i).destroy(); } } } checkOverlap(spriteA, spriteB) { var boundsA = spriteA.getBounds(); var boundsB = spriteB.getBounds(); return Phaser.Rectangle.intersects(boundsA, boundsB); } initializeObjects() { /* Initialize poles and objects */ for (var i = 0; i < 7; i++) { /* Top poles */ this.pole = new Pole(,(i * -200), 235, false); this.poleGroup.add(this.pole); /* Bottom poles */ this.pole = new Pole(,((i * 200) + 1024), 45, true); this.poleGroup.add(this.pole); /* Top objects */ this.object = new Object(,(i * -200), 300, false); this.objectsGroup.add(this.object); /* Bottom objects */ this.object = new Object(,((i * 200) + 1024), 100, true); this.objectsGroup.add(this.object); } } } }