valueerror Posted September 12, 2014 Share Posted September 12, 2014 according to the source:http://docs.phaser.io/World.js.html#sunlight-1-line-1461 convertCollisionObjects gets the properties// properties: json.layers[i].objects[v].properties,but does not do anything with it.. createBody would accept "options" int the 5th field but is using them to create the polygon.http://docs.phaser.io/World.js.html#sunlight-1-line-1378var result = body.addPolygon(options, data);so this is not the way to go.. (because addPolygon is only taking 3 special options .. so i instead of using this (real game example:)collisionareas = game.physics.p2.convertCollisionObjects(map,"collisionareas");i am now using this: var collisionareas = []; var layer = "collisionareas" for (var i = 0, len = map.collision[layer].length; i < len; i++) { var object = map.collision[layer][i]; var body = game.physics.p2.createBody(object.x, object.y, 0, true, {} , object.polyline); body.properties = object.properties; if (body){ collisionareas.push(body);} }then i am able to access the properties set in tiled on my collisonareas (polylines)for (i=0; i<collisionareas.length; i++){ if (collisionareas[i].properties.action == 'ramp'){ collisionareas[i].onBeginContact.add(jumpOnRamp, this); } }now my question is: did i NOT see the obvious way how to do this or is this just not implementet (yet) and.. is this ok to do this or is it dangerous to use something like "body.properties" because it is used somewhere else and will cause me troubles later on? thx in advance! Link to comment Share on other sites More sharing options...
Arcanorum Posted September 13, 2014 Share Posted September 13, 2014 Works better than the official implementation. Phaser seems to crap its pants at the sight of tilemaps ATM. Link to comment Share on other sites More sharing options...
Recommended Posts