Grafixator File Format
Grafixator files are saved in XML format. These XML files store all the map data, settings, properties and player movement properties that were configured in your grafixator game.
As grafixator is new there is currently only a loader/API for libgdx. This specification should assist any developers in creating their own loader for other platforms, libraries or frameworks:
<map>
- version: The grafixator version. This may be used in the future if any changes are made that breaks backwards compatability. Every effort will be made to avoid this.
- noCols: Number of columns in your tile map
- noRows: Number of rows in your tile map
- tilewidth: Width in pixels for each tile.
- tileheight: Height in pixels for each tile.
- duplicateTilePadding: The duplicate padding around each tile. This defaults to 1 and is used to prevent tile bleeding.
- bgR, bgG, bgB: The background R,G,B colour.
- gravity: The Box2d Gravity.
- density: The Box2d Density.
- restitution: The Box2d Restitution.
- friction: The Box2d Friction.
<settings>
- gridType: The users preferred grid type. 0,1 or 2 (Dots, Lines or Squares).
- playSounds: Play sounds boolean.
- playMusic: Play music boolean.
- particleEffects: Render particle effects boolean
- particleGravity: The particle effect gravity, +ve is downards, -ve upwards.
- particleVelocity: The velocity of the particle effects.
- noParticles: The number of particles to use in each particle effect.
- useBox2dLights: Use Box2d Lights boolean.
- box2dLightsShadows: Use Box2d Shadows boolean.
- box2dDiffuseLight:Use Box2d Diffuse Light boolean.
- showHud: Show Hud.
<spritesheets>
Currently can contain only 1 spritesheet:
<spritesheet>
- imageFile: Filename of the tilesheet .png file.
- width: Width of the spritesheet. Always 1024.
- height: Height of the spritesheet. Always 1024.
- noTiles: The number of tiles in the tile sheet.
<properties>
Properties can contain a number of tiles as below:
<properties> <tile number="4"> <property key="DESTRUCTABLE" value="HITS=3;"/> </tile> </properties>
- number: The tile number that corresponds to the position in the tilesheet.
<property>
- key: The tile key. For example “HERO_CHARACTER” indicates this tile is the hero.
- value: The string value associated with key. This string can contain multiple sub-properties separated by a ;. (i.g.. movementType=STANDARD;cameraControl=NONE; cameraSpeed=0;).
<collisionObjects>
<collisionObjects> <object type="RECTANGLE" width="109" height="168" originX="-252" originY="170" /> <object type="CIRCLE" originX="8" originY="672" radius="78.160095" /> <object type="PATH" vertices="-210,58 -156,-56 -17,-33 72,-24 173,-24 325,-46 440,-32 555,-57 650,-62 771,-3 848,98 862,218 "/> </collisionObjects>
<layers>
Layers contain all the tile layers and tiled map data:
<layers> <layer name="Background Layer" tileWidth="32" tileHeight="32"> <data>0,0,0,0,1,2,3,0,0,0,2,2,0,0,0,0,</data> . . . <data>0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,</data> </layer> <layer name="Collision Layer" tileWidth="32" tileHeight="32"> <data>0,0,0,0,1,0,0,4,4,0,0,3,0,0,0,0,</data> . . . <data>0,0,0,0,0,0,2,2,2,3,3,3,0,0,0,0,</data> </layer> </layers>
<timelines>
Timelines define the Tweening of your sprites around your game.
<timelines> <timeline spriteId="1" spriteIndex="1" loop="true" rotateSprite="false" speed="7.0" originXPos="448" originYPos="480" easing="5" width="64" height="64"> <events> <event seq="0" x="128" y="448" time="1.0285714" /> <event seq="1" x="128" y="352" time="0.34285715" /> <event seq="2" x="416" y="352" time="1.0285714" /> <event seq="3" x="416" y="448" time="0.34285715" /> </events> </timeline> <timeline spriteId="1" spriteIndex="0" loop="true" rotateSprite="false" speed="5.0" originXPos="64" originYPos="480" easing="0" width="64" height="64"> <events> <event seq="0" x="288" y="448" time="1.28" /> <event seq="1" x="288" y="320" time="0.64" /> <event seq="2" x="32" y="320" time="1.28" /> <event seq="3" x="32" y="448" time="0.64" /> </events> </timeline> </timelines>
An example Grafixator XML file
<?xml version="1.0" encoding="UTF-8"?> <map version="v0.1" noCols="16" noRows="16" tilewidth="32" tileheight="32" duplicateTilePadding="1" bgR="0.0" bgG="0.0" bgB="0.0" gravity="-9.0" density="0.6" restitution="0.1" friction="0.6"> <settings gridType="0" playSounds="false" playMusic="false" particleEffects="true" particleGravity="10.0" particleVelocity="10.0" noParticles="20" useBox2dLights="true" box2dLightsShadows="false" box2dLightsBlur="true" box2dDiffuseLight="false" showHud="false"/> <spritesheets> <spritesheet imageFile="exampleXML.png" width="1024" height="1024" noTiles="5"/> </spritesheets> <properties> <tile number="3"> <property key="HERO_CHARACTER" value="movementType=STANDARD;cameraControl=NONE;cameraSpeed=0;charSpeed=4.0;detectWallCollisions=false;detectEnemySpriteCollisions=false;fire=1;;bulletInterval=0.08;bulletSpeed=16;bulletXOffset=0;bulletYOffset=0;fullSquare=false;moveToBoundary=false;charRotateToDir=true;"/> </tile> <tile number="4"> <property key="DESTRUCTABLE" value="HITS=3;"/> </tile> <tile number="5"> <property key="BOX2DLIGHT" value="BDIS=96.0;BTYP=POINT;BCANG=90.0;BDANG=90.0;BCOL=0.8,0.0,0.8;BRAYS=16;"/> <property key="PLAYER_BULLET" value="NO_VALUE"/> </tile> </properties> <collisionObjects> <object type="RECTANGLE" width="109" height="168" originX="-252" originY="170" /> <object type="CIRCLE" originX="8" originY="672" radius="78.160095" /> <object type="PATH" vertices="-210,58 -156,-56 -17,-33 72,-24 173,-24 325,-46 440,-32 555,-57 650,-62 771,-3 848,98 862,218 "/> </collisionObjects> <layers> <layer name="Background Layer" tileWidth="32" tileHeight="32"> <data>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,</data> <data>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,</data> <data>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,</data> <data>0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,</data> <data>0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,</data> <data>0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,</data> <data>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,</data> <data>0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,2,</data> <data>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,</data> <data>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,</data> <data>0,0,0,0,0,2,2,2,2,2,2,0,0,0,0,0,</data> <data>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,</data> <data>0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,</data> <data>0,0,2,2,2,2,2,2,2,2,2,2,2,2,0,0,</data> <data>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,</data> <data>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,</data> </layer> <layer name="Collision Layer" tileWidth="32" tileHeight="32"> <data>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,</data> <data>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,</data> <data>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,</data> <data>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,</data> <data>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,</data> <data>0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,</data> <data>0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,</data> <data>0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,</data> <data>0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,1,</data> <data>0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,</data> <data>0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,</data> <data>0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,1,</data> <data>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,</data> <data>1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,</data> <data>0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,</data> <data>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,</data> </layer> </layers> <timelines> <timeline spriteId="1" spriteIndex="1" loop="true" rotateSprite="false" speed="7.0" originXPos="448" originYPos="480" easing="5" width="64" height="64"> <events> <event seq="0" x="128" y="448" time="1.0285714" /> <event seq="1" x="128" y="352" time="0.34285715" /> <event seq="2" x="416" y="352" time="1.0285714" /> <event seq="3" x="416" y="448" time="0.34285715" /> </events> </timeline> <timeline spriteId="1" spriteIndex="0" loop="true" rotateSprite="false" speed="5.0" originXPos="64" originYPos="480" easing="0" width="64" height="64"> <events> <event seq="0" x="288" y="448" time="1.28" /> <event seq="1" x="288" y="320" time="0.64" /> <event seq="2" x="32" y="320" time="1.28" /> <event seq="3" x="32" y="448" time="0.64" /> </events> </timeline> </timelines> <sprites imageFile="exampleXML_Sprites.png"> <sprite id="1" name="Random" width="64" height="64" isAnimation="false" noFrames="0" spriteSheetPosition="(0,0)" positions="(32,448);(416,448);"> </sprite> <sprite id="2" name="Random" width="64" height="64" isAnimation="false" noFrames="0" spriteSheetPosition="(64,0)" positions="(224,384);"> <properties> <property key="BOX2DLIGHT" value="BDIS=192.0;BTYP=CONE;BCANG=45.0;BDANG=90.0;BCOL=1.0,0.0,0.2;BRAYS=16;"/> <property key="ROTATE" value="RS=3.7;RD=true;FULLR=true;"/> </properties> </sprite> </sprites> </map>