Jump to content

Draw a polygon with P2 Physics


Recommended Posts

Hello everyone, i'm trying to draw a polygon with the P2 physics engine, but the only way i've found is to use the render function. How could i draw a polygon without an image, just drawing the points. (like in graphics). Sorry for the bad english.




var stageOne = {
    preload: function () {
        this.game.load.image('contra2', 'assets/img/lel.png');
        this.game.load.physics('data', 'assets/json/head.json');
        create: function () {
            contra = this.game.add.sprite(400, 300, null);
            this.game.physics.p2.enable(contra, true);
            this.graficas = this.game.add.graphics(0, 0);
            var personaje = new char(this.graficas,"Casiel");
        update: function () {
        render: function () {


Link to comment
Share on other sites


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...