The XML of a piece defines it, but you can adjust the heaviness, friction, etc. in the Piece Editor.
XML elements Edit
<object name="Moon Child" type="player" color="0x2492ff" instructions="Arrow keys or WASD to move."> <shape destroyable="true"> <perimeter> <polygon x="0" y="0"> <vertex x="-0.38" y="-0.1975"/> <vertex x="0.38" y="-0.1975"/> <vertex x="0.25" y="0.3575"/> <vertex x="0.1" y="0.4775"/> <vertex x="-0.1" y="0.4775"/> <vertex x="-0.25" y="0.3575"/> </polygon> </perimeter> <visual type priority url text font sourcePixelsPerMeter bitmapRelCentroidX bitmapRelCentroidY size outline/> <physics friction bounciness anchored density solid angularDeceleration deceleration angleLock ignoreSetAng gravity collisionSoundURL collisionSoundPriority source/> <prismaticJoint angOffset length/> <revoluteJoint x y/> </shape> <controller> <keyPress action key extraKey/> <regularInterval interval/> <onDestroyed/> <randomInterval shortInterval longInterval/> <always/> <mouseButton action/> <otherSighted maxDist angleOffset type/> <otherCollided side typeFilter minForce onlyLoose> <awardScoreOfOther scoreOnce typeFilter/> <addLife livesAwarded/> <thrust groundHug impulse speedLimit onePerLife forceAsAbsoluteVel absoluteAng offsetAng rangeOfMaxImpulse/> <scoreSelf scoreOnce/> <destroyOther/> <shoot projectile xOffset yOffset angleOffset vAngle impulse reloadTime angleInaccuracy rangeOfMaxImpulse onePerLife angleAtTarget inheritMomentum inheritGoalStatus rotateChild/> <pullTarget speed/> <faceMoveDir/> <teleportOther/> <wrapPosition hWrap vWrap/> <yankOther force offsetAng maxDist/> <targetTypeNearest targetType needsLOS mustBeDestroyable/> <torque torque/> <moveToTarget groundHug absoluteForce movePower minDist/> <threeTouch/> <warpPlayer/> <destroySelf forceDestroy/> <addAng angle/> <targetOther/> <regulateSpeed min max/> <playAnim animLabel/> <oscillate range pauseTime moveSpeed offsetAng/> <moveToMouse groundHug absoluteForce movePower minDist/> <emitPFX sourcePixelsPerMeter lifetime quantity scale color_r color_g color_b velocity inheritRotation inheritMomentum angleOffset resistance gravity visualURL alpha vAngle xOffset yOffset/> <thrustOther velocity offsetAng/> <lookAtTarget secondaryDisplayLayerOnly turnSpeed/> <explode typeFilter blastRadius killRadius destroySelf blastImpulse/> </otherCollided> </controller> </object>
- Name of the piece, can also be changed when finishing the piece.
- Type of the piece. Possible types are: player, world, enemy, treasure, key, lock
- Only if player piece. Will be displayed on the instructions screen of the game.
- "yes" causes deaths to be added to a total instead of having lives.
- The default score of the piece. Only works for treasures and enemies.
- The default color of the piece. Only applies when you copy the piece and the color is not already used for another instance of the piece.
- The default transparency settings for the piece.
- The default amount of lives of the player piece.
Compulsory. Defines how the piece interacts with other pieces and the screen.
- If true, it won't inteact with anything. Default value: "false"
- Whether the piece is destroyable or not. Default value: "false"
- If set to "true",
<otherCollided>won't be triggered off for other pieces that hit the piece and the piece itself. Default value: "false"
- Whether the piece is climbable or not. Climbable pieces tell other pieces that they are 'grounded' when they are over them. Default value: "false"
The piece's shape.
Adds a circle. x/y-coordinates determine the center of the circle.
Adds a box. x/y-coordinates determine the center of the box.
Adds a polygon. x/y-coordinates should be added to the vertexes' coordinates, but they don't.
Note: polygons mustn't be concave, meaning there must not be any angle over 180°.
Defines a vertex of a polygon. The maximum amount of vertexes per polygon is 8.
the piece's appearance.
- The type of the graphics. Possible values: jpg, swf
- The layering of the piece. If it's 3 or below, the piece can move without the graphics moving.
- The URL of the piece's graphics.
- The default text for the piece. Only use for text pieces.
- The text's font. Only use for text pieces.
- How many of the graphics' pixel fill one of PlayCrafter's meters.
- X-offset for images in pixels.
- Y-offset for images in pixels.
- The Graphics' size. Default value: 1
- If "on", a black line displays the shape defined in
<perimeter>. Usage of this to get around not having Premium is discouraged.
- Default friction of the piece. Changeable in the Piece Editor.
- Default bounciness of the piece. Changeable in the Piece Editor.
- Whether the piece is anchored or not (causes it to have a fixed position and rotation). Use "editable" to be able to set it in the Piece Editor.
- Default density of the piece. Changeable in the Piece Editor.
- Whether the piece is solid or not. Use "editable" to be able to set it in the Piece Editor.
- How much rotation is reduced over time.
- How much the speed is reduced over time.
- Whether the piece can rotate or not.
- If "true", you can't turn it in the Workshop.
- Whether the piece is affected by gravity or not. Use "editable" to be able to set it in the Piece Editor.
- The URL of the collision sound.
- The proirity of the collision sound. Use a high value to make sure it can be heard.
- "perimeter": has the shape defined in
<perimeter>; "visual_as_rectangle": Use for text pieces. Auto-adjusts the perimeter to the text's size.
Makes the piece able to only move in one direction.
- The angle offset of the prispatic joint. Measured clockwise.
- The lenth of the prismatic joint. The piece can't move further if it reaches the end of it.
Makes the piece rotate around a certain point.
Contains the stimuli.
Triggers when a key is pressed.
- "OnDown": when the key is pressed; "WhileDown": While the key is pressed
- Which key
- Alternative key
The interval, measured in seconds.
Triggers when the piece is destroyed. Works also if the piece isn't destroyable.
Triggers at a random period between
Minimum possible time in seconds.
Maximum possible time in seconds.
Triggers on every frame, afterDelay things cause it to behave like a
Triggers when the left mouse button is pressed.
- "OnDown": when the key is pressed; "WhileDown": While the key is pressed
Triggers when the piece is in sight of another piece.
- Maximum distancethe other piece can be for the stimulus to trigger off.
- Angle offset. Measured clockwise.
- The object sighted has to be of a certain type for the stimulus to trigger off.
Triggers when the piece collides.
- Which side the piece collides. Possible values: right, left, up, down (not verified)
- Triggers only if the collided piece is of a certain type.
- The minimum force the other piece ha to hit the piece for the stimulus to trigger off.
- Triggers only if the other piece isn't anchored.
Awards the other piece's score.
Adds a life.
How many lives? Default is 1.
Moves the piece.
- If "true", it will only work on the ground.
- The force the piece is affected with.
- The maximum speed the piece can achieve with this thrust.
- If "true", the piece can only thruse once per life. Useful for golf balls.
- Doesn't thrust but set the velocity for the piece.
- If "true", it will go exactly in the same direction as if it were upright, no matter what.
- The angle offset of the force.
Awards the piece's score.
Destroys the other piece.
Shoots a projectile.
- Rotational speed of the projectile.
- The force the projectile is shot off with.
- The minimum amount of time between two shots.
- If "true", the piece can only shoot once per life.
- Whether the projectile inmherits the momentum of the piece or not.
- Whether the projetctile inherits the goal status of the piece or not.
Tugs on any target selected by another XML tag.
The piece faces the direction it is moving in, and if not moving it defaults at East. Useful for projectiles.
Teleports the other piece.
Lets the piece appear on the other side of the screen if it'd else go out. Doesn't work with solid pieces.
- horizontal wrap
- Vertical wrap
Targets another piece.
Rotates the piece.
Code of the 3 connect gem. Causes the piece to self-destruct if at least three same-colored versions of itself are touching.
Warps the player to another level or just teleports him, depending on whether there's another piece of it's kind in the level or not.
Destroys the piece.
- If "true", the piece will still be destroyed if it's undestroyable. Else, only
<onDestroyed>will be triggered.
Forces an amount of rotation into the piece. It will also rotate if it is anchored.
How much the piece is rotated. If set to zero, it will randomly rotate.
Targets the other piece, if named by another XML tag.
Checks how fast the piece is moving, and if the speed is outside the min and max, the speed will be adjusted.
Minimum speed allowed. Set to 0 for no minimum.
Maximum speed allowed. Set to 0 to completely stop motion.
Plays the animation with the label declared in
animLabel. Does only work when a correct swf is used as graphics.
Chooses which animation set in the swf to play. Obviously will not work if label does not exist in swf.
Causes the piece to move back and forth in one direction. Best used with an always parent. All three tags here work with the "editable" setting.
How far the piece moves.
When the piece finishes, how long it waits before moving again.
How fast oscillation occurs.
Forces the piece to move to the mouse.
Emits particles. see Particle Effect for more details. PFX take a visualPriority of 3.
The piece looks at the target specified by
The piece explodes... Invisibly. You'll need to create your own appearance using animation or some other means.
- If set, the explosion only affects pieces of a certain type.
- The radius in which other pieces are blasted away.
- The radius in which other pieces are destroyed.
- Whether the piece itself is destroyed by the explosion or not.
- The force the other pieces are blown away with.
For all stimuli, you can add one or more of the following conditions, causing the stimuli to only act if these conditions are met:
The piece must be on the ground. Works like
- The piece must be in mid-air.
- The piece must have motion.
- The piece must NOT have motion.
- The piece must be moving up.
- The piece must be moving down.
- The piece must be moving left.
- The piece must be moving right.
- The piece must be looking up.
- The piece must be looking down.
- The piece must be looking left.
- The piece must be looking right.
- The piece must not be moving upwards.
- The piece must not move neither right nor left.
- The stimulus only triggers once.
- Intended for isometric pieces, but usable with other styles of pieces. Possible values are: N, NE, E, SE, S, SW, W, NW.
- Triggers the actions a certain time after the stimulus was triggered.
BlockAnim="true" can be used in every action to stop the animation. Actually only useful in
<playAnim/> to stop all other animations. Certain ways to develop the swf will allow it to start being given new playAnim commands, but how it works will not be went over here, as this is not the appropriate topic.