Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <h2>TiledSpritemap</h2> <p>TiledSpritemap is used to make single animated sprite tile (for example, 32x32px) be tiled across X or Y (or both of them). For example, if you have lava spritesheet, that contains 7 sprites of boiling lava and you'd like to create pool of lava, you may use this class. Example of use:</p> <pre><code>// embed a resource somewhere in your class [Embed(source = "../../assets/lava.png")] private var lavaGfx:Class; public function AnimatedEntity () { var spriteWidth:uint=32; var spriteHeight:uint=32; var objectWidth:uint=100; // pool of lava, that has 100px width var objectHeight:uint=32; var t = new TiledSpritemap(this.lavaGfx, spriteWidth, spriteHeight, objectWidth, objectHeight ); t.add("boil", [0, 1, 2, 3, 4, 5, 6], 4, true); graphic = hb; t.play("boil"); } </code></pre> <p>where, instead of <em>spriteWidth</em> and <em>spriteHeight</em> you should use width and height of a single sprite in your spritesheet (32x32, for instance), instead of <em>objectWidth</em> and <em>objectHeight</em> - desired width and height of your object. Function <em>t.add</em> has the following attributes: name of the animation, that would be used, when you call "play"; array of frame indices to animate through; frameRate of the animation; boolean, that set whether the animation should loop. </p> <h2>Spritemap</h2> <p>Spritemap can be used for making bunch of different animations from one spritesheet, using code, similar to the code mentioned above:</p> <pre><code>public function AnimatedEntity () { var spriteWidth:uint= 32; var spriteHeight:uint= 32; var t = new Spritemap(enemyGfx, spriteWidth, spriteHeight); t.add("run", [0, 1, 2], 10, true); t.add("jumpUp", [3, 4], 9, true); t.add("jumpDown", [5, 6], 9, true); t.add("attack", [7, 8, 9], 10, true); t.add("standIdle", [10, 11, 12], 10, true); } </code></pre> <p>At the moment, FlashPunk out of the box is not able to use spritesheets (or Atlases, as it was called in other 2d game engines) that made of sprites with different sizes.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload