Added phaser build and hellophaser sample
This commit is contained in:
73
resources/PhysicsEditor Exporter/exporter.xml
Normal file
73
resources/PhysicsEditor Exporter/exporter.xml
Normal file
@@ -0,0 +1,73 @@
|
||||
<exporter>
|
||||
<name>phaser-json</name>
|
||||
<displayName>Phaser (JSON)</displayName>
|
||||
<description>Exporter for Phaser, JSON</description>
|
||||
<version>1.0</version>
|
||||
<yAxisDirection>down</yAxisDirection>
|
||||
<physicsEngine>box2d</physicsEngine>
|
||||
<template>phaser.json</template>
|
||||
<fileExtension>json</fileExtension>
|
||||
<anchorPoint>
|
||||
<enabled>no</enabled>
|
||||
</anchorPoint>
|
||||
<origin>
|
||||
<type>fixed</type>
|
||||
<relX>0.0</relX>
|
||||
<relY>1.0</relY>
|
||||
</origin>
|
||||
<supportsCircles>yes</supportsCircles>
|
||||
<body>
|
||||
</body>
|
||||
<fixture>
|
||||
<parameter>
|
||||
<name>fixtureKey</name>
|
||||
<description>Give this fixture a unique KEY so you can retrieve it later in phaser</description>
|
||||
<displayName>Fixture's Key</displayName>
|
||||
<type>string</type>
|
||||
<default></default>
|
||||
</parameter>
|
||||
|
||||
<parameter>
|
||||
<name>isSensor</name>
|
||||
<displayName>Is Sensor</displayName>
|
||||
<description>If set the physial </description>
|
||||
<type>bool</type>
|
||||
<default>false</default>
|
||||
</parameter>
|
||||
|
||||
<parameter>
|
||||
<name>filter_groupIndex</name>
|
||||
<displayName>Group</displayName>
|
||||
<description>Collision group.</description>
|
||||
<shortDescription></shortDescription>
|
||||
<type>int</type>
|
||||
<default>0</default>
|
||||
</parameter>
|
||||
|
||||
<parameter>
|
||||
<name>filter_bitfield</name>
|
||||
<type>bitfield</type>
|
||||
<size>16</size>
|
||||
</parameter>
|
||||
|
||||
<parameter>
|
||||
<name>filter_categoryBits</name>
|
||||
<displayName>Cat.</displayName>
|
||||
<description>Collision category</description>
|
||||
<shortDescription>Collision category</shortDescription>
|
||||
<type>uint16</type>
|
||||
<default>1</default>
|
||||
<bitfield>yes</bitfield>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<name>filter_maskBits</name>
|
||||
<displayName>Mask</displayName>
|
||||
<description>Collision mask</description>
|
||||
<shortDescription>Collision mask</shortDescription>
|
||||
<type>uint16</type>
|
||||
<default>65535</default>
|
||||
<bitfield>yes</bitfield>
|
||||
</parameter>
|
||||
</fixture>
|
||||
</exporter>
|
||||
|
||||
35
resources/PhysicsEditor Exporter/phaser.json
Normal file
35
resources/PhysicsEditor Exporter/phaser.json
Normal file
@@ -0,0 +1,35 @@
|
||||
{ {% for body in bodies %}
|
||||
{% if not forloop.first %}, {% endif %}
|
||||
"{{body.name}}": [
|
||||
{% for fixture in body.fixtures %}{% if not forloop.first %} ,{% endif %}
|
||||
{
|
||||
{% if fixture.fixtureKey %}
|
||||
"fixtureKey": "{{fixture.fixtureKey}}",
|
||||
{% endif %}
|
||||
"isSensor": {{fixture.isSensor}},
|
||||
"filter": {
|
||||
"group": {{fixture.filter_groupIndex}},
|
||||
"categoryBits": {{fixture.filter_categoryBits}},
|
||||
"maskBits": {{fixture.filter_maskBits}}
|
||||
},
|
||||
|
||||
{% if fixture.isCircle %}
|
||||
"circle": {
|
||||
"radius": {{fixture.radius|floatformat:3}},
|
||||
"position": [
|
||||
{{fixture.center.x|floatformat:3}},
|
||||
{{fixture.center.y|floatformat:3}}
|
||||
]
|
||||
}
|
||||
{% else %}
|
||||
"polygons":[
|
||||
{% for polygon in fixture.polygons %}{% if not forloop.first %} ,{% endif %}
|
||||
[ {% for point in polygon %} {% if not forloop.first %}, {% endif %} {{point.x}}, {{point.y}} {% endfor %} ]
|
||||
{% endfor %}
|
||||
]
|
||||
{% endif %}
|
||||
}
|
||||
{% endfor %}
|
||||
]
|
||||
{% endfor %}
|
||||
}
|
||||
Reference in New Issue
Block a user