• Content Count

  • Joined

  • Last visited

About spiritabsolute

  • Rank
  • Birthday 07/18/1989

Recent Profile Visitors

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

  1. I found how to implement it. thanks valueerror
  2. I found a similar topic , but my map.collision[layer] === undefined
  3. Thanks for the answer. Your method I use to work with objects. I do not want my walls were objects on a separate layer. My wall tiles should be. I cut the tiles of the walls in the tiled editor.
  4. I created map by tiled editor. My collision layer have walls and it placed on the tile 64x64. I set collision for tile width 16px, because I need to the actual width of the wall was 16px. The remaining area is transparent. Tiled Editor allows you to do that, everything looks good. But, how to use a tile collision created in the tiled editor from phaser? Created tile collision, create an object in the json structure "tiles":{"2":{"objectgroup": etc. How to use the phaser api set Collision to these tiles? –°onvertCollisionObjects does not work. Cannot read property 'length' of undefined -> for (var i = 0, len = map.collision[layer].length; i < len; i++) this.game.physics.p2.convertCollisionObjects(this.map, 'walls'); As if tiled editor has generated the not correct structure. phaser v2.6.2, tiled Version 0.17.0 My json file have structure: { "columns":4, "firstgid":1, "image":"..\/tiles\/fullSetTiles.png", "imageheight":64, "imagewidth":259, "margin":0, "name":"fullSetTiles", "spacing":1, "tilecount":4, "tileheight":64, "tiles": { "2": { "objectgroup": { "draworder":"index", "height":0, "name":"", "objects":[ { "height":64, "id":1, "name":"", "rotation":0, "type":"", "visible":true, "width":16, "x":0, "y":0 }], "opacity":1, "type":"objectgroup", "visible":true, "width":0, "x":0, "y":0 } }, "3": { "objectgroup": { "draworder":"index", "height":0, "name":"", "objects":[ { "height":16, "id":2, "name":"", "rotation":0, "type":"", "visible":true, "width":64, "x":0, "y":0 }, { "height":48, "id":3, "name":"", "rotation":0, "type":"", "visible":true, "width":16, "x":0, "y":16.25 }], "opacity":1, "type":"objectgroup", "visible":true, "width":0, "x":0, "y":0 } } }, "tilewidth":64 },
  5. I realized this: movePlayer: function() { this.player.directionX = this.game.input.activePointer.worldX - this.player.x; this.player.directionY = this.game.input.activePointer.worldY - this.player.y; this.player.endMovePointX = this.game.input.activePointer.worldX; this.player.endMovePointY = this.game.input.activePointer.worldY; this.player.body.rotation = Math.atan2(this.player.directionY, this.player.directionX) + this.game.math.degToRad(-90); var angle = this.player.body.rotation + (Math.PI / 2); this.player.isMoves = true; this.player.body.velocity.x = this.player.walkSpeed * Math.cos(angle); this.player.body.velocity.y = this.player.walkSpeed * Math.sin(angle); }, update: function() { if(this.player.isMoves) { if(this.math.sign(this.player.directionX) === 1) { if(this.player.x > this.player.endMovePointX) this.player.body.velocity.x = 0; } else { if(this.player.x < this.player.endMovePointX) this.player.body.velocity.x = 0; } if(this.math.sign(this.player.directionY) === 1) { if(this.player.y > this.player.endMovePointY) this.player.body.velocity.y = 0; } else { if(this.player.y < this.player.endMovePointY) this.player.body.velocity.y = 0; } } else { this.stopMovePlayer(); } },
  6. this.game.add.tween(this.ship.body).to({ x: pointer.position.x, y: pointer.position.y }, 1000,Phaser.Easing.Linear.None,true); this method does not seem right and it does not work properly
  7. Hi all! How to move to the point of clicks at p2js? this.game.input.onDown.add(this.onClick, this); In the event handler I have "pointer.position". What's next? I did not find a single example. I found a similar question here, but there is no answer to it. http://stackoverflow.com/questions/36120249/precision-moving-a-body-using-phaser-and-p2-js-physics
  8. I was also interested in it! I was beginning to wonder why I use P2JS? How to understand whether I need P2JS. It may be better to use arcade?