Search the Community
Showing results for tags 'polyline'.
-
Hi, I am currently creating a polygon geometry with PIXI.Graphics. As one of the requirements of our application, we need to add fill color after we create a graphic. Is there any way to do it? Currently, we have something like below. const graphic = new PIXI.Graphics(); graphic.lineStyle(2, style.color, 1); for (..){ if (type === 1) graphic.lineTo(x, y); else graphic.moveTo(x, y); } As you can see, this will simply create a polyline but we need to find a way to fill this polyline with some color and convert it to polygon. *this needs to be a polyline when it was created It would be appreciating if you could give me any advise to achieve this.
-
Hello, I'm trying to set collision with Tiled using the "Tile Collision Editor" on Tiled but I can't make it work on game. Basically I want to create a Polyline for each different Tiles so I don't have to copy/paste the polyline objects in the object layer. For the moment I use one big Polyline object on a object layer that follow my map but it's not viable beause I have to draw all my tiles manually. Here is the part of the code I use to incorporate the object layer (I'm using ES6). It's working but it's not what I want : this._map = new Map(this._game, mapName);// ...this._map.addTilesetImage(tilesName, tilesName);this._blocksLayer = this._map.createLayer('collision');this._blocksLayer.resizeWorld(); this._game.physics.p2.convertTilemap(this._map, this._blocksLayer); this._game.physics.p2.convertCollisionObjects(this._map, 'test'); // where 'test' is the name of my layerThanks in advance for the help !
-
this is how the array that contains all the physicsbodies is created polyline_bodies = game.physics.p2.convertCollisionObjects(supermap,"polygons");i can then cycle over all bodies and flawlessly set collisiongroups, materials and so on.. but if i want to cycle through this array and kill the physics bodies in it for (i=0; i<polyline_bodies.length; i++){ polyline_bodies[i].destroy()}i get the following weird error: Uncaught TypeError: Cannot set property 'body' of nullc.Physics.P2.Body.destroy @ phaser.min.js:23level0.update @ game.js:616how can i destroy the bodies in there.. thank you !