<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="commands.xsl"?>

<commands>
  <command name="image">
    <desc>
      Sets the object's image, uses a rectangle [x, y, w, h] from the specified texture. Only static images are supported right now.
    </desc>
    <params>
	  <param name="texture" type="Texture"/>
	  <param name="x" type="u8"/>
	  <param name="y" type="u8"/>
	  <param name="w" type="u8"/>
	  <param name="h" type="u8"/>
	</params>
  </command>
  <command name="hitbox">
    <desc>
      Sets the object's hit radius. Collision detection uses circles around object center, this command changes that circle's radius.
    </desc>
    <params>
	  <param name="radius" type="u8"/>
	</params>
  </command>
  <command name="power">
    <desc>
      Changes the object's power to the specified value. When two objects collide, their powers are substracted from each other. An object with power &lt;= 0 is immediately destroyed. So power represents hitpoints as well as damage.<br/>
      Note: Projectiles created with "fire" are always destroyed in a collision.
    </desc>
    <params>
	  <param name="power" type="f32"/>
	</params>
  </command>
  <command name="pos">
    <desc>
      Changes the object's position to (x, y). The standard level bounds are 256.0x356.0
    </desc>
    <params>
	  <param name="x" type="f32"/>
	  <param name="y" type="f32"/>
	</params>
  </command>
  <command name="move">
    <desc>
      Moves the object by (dx, dy), its new position will then be (x+dx, y+dy). This movement is immediate, to move towards a point over the course of several frames use "move_to" instead.
    </desc>
    <params>
	  <param name="dx" type="f32"/>
	  <param name="dy" type="f32"/>
	</params>
  </command>
  <command name="move_to">
    <desc>
      Moves the object towards the point (x, y) with a speed of (speed). Sets speed and speed_inc to 0.
    </desc>
    <params>
	  <param name="x" type="f32"/>
	  <param name="y" type="f32"/>
	  <param name="speed" type="f32"/>
	</params>
  </command>
  <command name="speed">
    <desc>
      Sets the object's speed. Every frame, the object advances (speed) distance.
    </desc>
    <params>
	  <param name="speed" type="f32"/>
	</params>
  </command>
  <command name="speed_to">
    <desc>
      Changes speed to the desired value over the course of several frames. The speed changes with (accel) per frame. (accel) should always be positive regardless of whether the objects needs to speed up, slow down or even reverse its speed.
    </desc>
    <params>
	  <param name="target_speed" type="f32"/>
	  <param name="accel" type="f32"/>
	</params>
  </command>
  <command name="speed_inc">
    <desc>
      Changes the object's accelleration. It's speed is updates to (speed+accel) every frame.
    </desc>
    <params>
	  <param name="accel" type="f32"/>
	</params>
  </command>
  <command name="angle">
    <desc>
      Change the object's angle to the specified value. The angle should range between 0 and 511, due to the implementation of the game's SIN/COS functions. Use angle 0 for up, 128 for right, 256 for down, 384 for left. Intermediate values obviously specify angles in between.
    </desc>
    <params>
	  <param name="angle" type="angle"/>
	</params>
  </command>
  <command name="angle">
    <desc>
      Changes the angle towards an object or named position instead of a value. Follow the AngleTarget link for a list possible values.
    </desc>
    <params>
	  <param name="angle" type="AngleTarget"/>
	</params>
  </command>
  <command name="angle_inc">
    <desc>
      Every frame, an object's angle is changed to (angle+angle_inc).
    </desc>
    <params>
	  <param name="accel" type="angle"/>
	</params>
  </command>
  <command name="turn">
    <desc>
      Increases an objects angle by (angle).
    </desc>
    <params>
	  <param name="angle" type="angle"/>
	</params>
  </command>
  <command name="turn_to">
    <desc>
      Keep turning an object for several frames until its angle matches (target_angle).
    </desc>
    <params>
	  <param name="target_angle" type="angle"/>
	  <param name="turn_speed" type="angle"/>
	</params>
  </command>
  <command name="turn_to">
    <desc>
      Keep turning an object for several frames until it's directed at (target). Follow the AngleTarget link for a list possible values.
    </desc>
    <params>
	  <param name="target" type="AngleTarget"/>
	  <param name="turn_speed" type="angle"/>
	</params>
  </command>
  <command name="show">
    <desc>
      Shows a previously hidden object. Also see "hide".
    </desc>
    <params>
	</params>
  </command>
  <command name="hide">
    <desc>
      Hides an object. A hidden object doesn't collide with other objects, but it can still move/turn/fire/etc.
    </desc>
    <params>
	</params>
  </command>
  <command name="advance">
    <desc>
      Moves the object forward by (distance), the direction it moves in depends on its angle.
    </desc>
    <params>
	  <param name="distance" type="f32"/>
	</params>
  </command>
  <command name="advance_side">
    <desc>
      Moves the object sideways by (distance), the direction it moves in depends on its angle.
    </desc>
    <params>
	  <param name="distance" type="f32"/>
	</params>
  </command>
  <command name="die">
    <desc>
      Kills the object, removing it from the game.
    </desc>
    <params>
	</params>
  </command>
  <command name="drop">
    <desc>
      Drops up to (amount) items of type (type), each object having a chance of (change)% of appearing. You may omit chance, or both chance and amount. If you omit chance the object is dropped with 100% possibility. If you also omit amount, amount is considered to be 1. Follow the ItemType link for a list possible values.
    </desc>
    <params>
	  <param name="type" type="ItemType"/>
	  <param name="amount" type="u8"/>
	  <param name="chance" type="percentage"/>
	</params>
  </command>
  <command name="wait">
    <desc>
      Don't execute any more commands for the next (frames) number of frames. The game runs at 60 frames per second, so to wait three seconds use "wait 180".
    </desc>
    <params>
	  <param name="frames" type="u16"/>
	</params>
  </command>
  <command name="fire">
    <desc>
      Creates an projectile from the specified object template. Projectiles fired by enemies can only collide with the player, and player-created projectiles only collide with enemies, not their projectiles. To create an object see "create". Any parameters after the first are passed to the created object.
    </desc>
    <params>
	  <param name="object" type="Object"/>
	  <param name="params" type="vararg"/>
	</params>
  </command>
  <command name="create">
    <desc>
      Creates an enemy object from the specified object template. The created object is spawned at the position of its creator, or at (LEVEL_WIDTH/2, 0) if it's not spawned from another object. To create a projectile see "fire". Any parameters after the first are passed to the created object.
    </desc>
    <params>
	  <param name="object" type="Object"/>
	  <param name="params" type="vararg"/>
	</params>
  </command>
  <command name="create_boss">
    <desc>
      NOT IMPLEMENTED YET. In the future, this command'll create a boss/midboss. Any parameters after the first are passed to the created object.
    </desc>
    <params>
	  <param name="object" type="Boss"/>
	  <param name="params" type="vararg"/>
	</params>
  </command>
  <command name="call">
    <desc>
      Calls a subroutine (spell) with certain parameters.
    </desc>
    <params>
	  <param name="object" type="Spell"/>
	  <param name="params" type="vararg"/>
	</params>
  </command>
  <command name="fork">
    <desc>
      Asynchronously starts another spell. A level has a single spell (main) running at the beginning of the stage. Use this command to add multiple threads of execution.
    </desc>
    <params>
	  <param name="object" type="Spell"/>
	  <param name="params" type="vararg"/>
	</params>
  </command>
  <command name="boss_name">
    <desc>
      Sets the name of a boss object.
    </desc>
    <params>
	  <param name="name" type="string"/>
	</params>
  </command>
  <command name="boss_num_spellcards">
    <desc>
      Sets the spellcard counter of a boss object as displayed in the upper-left corner of the screen. You need to set the number of spellcards manually, the program doesn't detect it on its own.
    </desc>
    <params>
	  <param name="spells" type="u8"/>
	</params>
  </command>
  <command name="boss_spell">
    <desc>
      Starts the spell referenced by "object". Also sets the boss' hp, the amount of time the spellcard will last and the spellcard's name. NOTE: Boss objects are invulnerable unless they're casting a spell through this command.
    </desc>
    <params>
	  <param name="name" type="string"/>
	  <param name="life" type="f32"/>
	  <param name="time" type="u16"/>
	  <param name="object" type="Spell"/>
	  <param name="params" type="vararg"/>
	</params>
  </command>
  <command name="end_stage">
    <desc>
      Wait approximately 5 seconds and then ends the stage, showing the results screen.
    </desc>
    <params/>
  </command>
  <command name="bgm">
    <desc>
      Changes the background music. Searches the game's bgm folder for the file first: (TouhouDS/games/game_name/bgm). If the file isn't found there, the program-wide bgm folder is used (TouhouDS/bgm).
    </desc>
    <params>
	  <param name="filename" type="string"/>
    </params>
  </command>
</commands>
