codermua Posted June 14, 2016 Share Posted June 14, 2016 Hi, dear game developers. I had seen that link on examples load-polygon-1 or var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render }); function preload() { game.load.image('contra2', 'assets/pics/contra2.png'); // Load our physics data exported from PhysicsEditor game.load.physics('physicsData', 'assets/physics/sprites.json'); } var contra; var start = false; function create() { // Enable p2 physics game.physics.startSystem(Phaser.Physics.P2JS); contra = game.add.sprite(400, 300, 'contra2'); // Enable the physics body on this sprite and turn on the visual debugger game.physics.p2.enable(contra, false); // Clear the shapes and load the 'contra2' polygon from the physicsData JSON file in the cache contra.body.clearShapes(); contra.body.loadPolygon('physicsData', 'contra2'); // Just starts it rotating game.input.onDown.add(function() { start = true; }, this); } function update() { if (start) { contra.body.rotateLeft(250); } } function render() { } , and i'm trying create json like that, since i saw that example. I saw some suggestions about physics editor or mapeditor tiled. i installed it, but i have no idea about creating json like that despite researching how its doing on internet. Probably i need some help Link to comment Share on other sites More sharing options...
Recommended Posts