javascript - Why addPolygon change position image - phaser.js -
i have problem when use addpolygon. polygon change position image. when turn on debug see images, , new shape draw in center. second problem don't why image , shape polygon different. how fix problem ? not seen problem when use addrectangle. image , new shape corect in tile 70px x 70px.
function create() { ... groups.tile = game.add.group(); groups.tile.enablebody = true; groups.tile.enablebodydebug = true; groups.tile.physicsbodytype = phaser.physics.p2js; groups.tile.collideworldbounds = false; ... var obj = groups.tile.create((x * map.width) - (map.width / 2), (y * map.height) - (map.height / 2), spritename, numbertile); obj.body.static = true; obj.body.fixedrotation = true; obj.body.collideworldbounds = true; obj.body.clearshapes(); var mypolygonarray= [ [0,0], [0,70], [70,70], [70,46], [25,46], [25,0]]; obj.body.addpolygon({}, mypolygonarray); }
example:
a) b) c)
if found there solution?
Comments
Post a Comment