Recently in learning Citrus Engine.
This post is based on a foreigner's translation, no full-text translation. Original view
-----------------------------------------------------------------------------------------------
Physics games often involve complex polygons, and we will use Physicseditor to complete the process of editing this polygon.
Import a picture to create a polygon model
Let's look at the effect of the example below: Click to see the effect
How to use: Pressing the TAB key will show an input box, at this time enter:
Set box2d visible False
and press ENTER will appear after the original, set box2d visible true is the reverse.
-----------------------------------------------------------------------------
New file = "Add Sprites after adding a picture, it can be edited according to the picture, the editing method is very simple
Basically just a few buttons:
The first one is to add a circular rigid body
The second is to add a polygonal rigid body
The third to see the magic wand inside the tool, the role is based on the edge of the picture automatically depicted
The back two is flipped.
Edit well and then click Publish to export the XML file we need.
As follows
<exporter> <!--identifier of the exporter-and <name>box2d-alchemy</name> <!--name F Or the Dropbox-<displayname>citrusengine ActionScript (FLASH) </displayName> <!--description Of the exporter---<description>citrusengine ActionScript for flash</description> <!--exporter Version-<version>1.0</version> <!--direction of the Y Axis:up/down-<yaxisdirec Tion>down</yaxisdirection> <!--physics engine to use:box2d, chipmunk--<PHYSICSENGINE>BOX2D&L T;/physicsengine> <!--name of the template file----<template>citrusengine.as</template> & lt;! --File Exension for the data file--<fileExtension>as</fileExtension> <!--anchor Point settings -<anchorPoint> <!--is anchor points supported? Yes/no-<enabled>no</enabled> <!--relativePosition of the default anchor point--<relX>0.0</relX> <relY>0.0</relY> </anchorpo Int> <origin> <!--origin (0/0) point of the polygons can is set to "Anchorpoin
T "or" fixed "use <relX>0.5</relX> <relY>0.5</relY> to specify a fixed origin. Default is 0.5/0.5-<type>fixed</type> <relX>0.0</relX> <rel Y>1.0</rely> </origin> <!--custom global Parameters--<global> </global> & lt;!
--Custom Body Parameters-<body> </body> <!--Custom Fixture Parameters---<fixture> <parameter> <name>density</name> <displayName>Density</displayName> <descript Ion>density of the shape. Used for calculating the mass.</description> <shortdescription>density of the shape. Used for CALCULating the mass.</shortdescription> <type>float</type> <default>1</default> </par
ameter> <parameter> <name>friction</name> <description>Fricion.</description> <shortDescription>Friction.</shortDescription> <displayName>Friction</displayName> < type>float</type> <default>0.6</default> </parameter> <parameter> <name>r Estitution</name> <displayName>Restitution</displayName> <description>restitution defines How much a shape bounces.</description> <shortdescription>density of the shape. Used for calculating the mass.</shortdescription> <type>float</type> <default>0.3</defaul t> </parameter> </fixture> </exporter>
How to use:
var pe:physicseditorobjects = new Physicseditorobjects ("PE", {x:200, Peobject: "Muffin", View: "Muffin.png", Registration: "TopLeft"})
Add (PE);
Finally attach source code and template download address
physicseditor template zip file.
Physicseditor Example zip file.