I’ve tried to find out how to do this but I can’t figure it out.
Basically I want to set a sprite with animations to a specific x/y coordinate. How can this be done?
Main.as
package
{
import net.flashpunk.World;
/**
* ...
* @author Brendyn Todd
*/
public class TestingWorld extends World
{
public function TestingWorld()
{
add(new torch());
}
}
}
torch.as
package
{
import net.flashpunk.Entity;
import net.flashpunk.graphics.Image;
import net.flashpunk.graphics.Spritemap;
/**
* ...
* @author Brendyn Todd
*/
public class torch extends Entity
{
[Embed(source = 'assets/Torch.png')] private const TORCH:Class;
public var sprTorch:Spritemap = new Spritemap(TORCH, 16, 16)
public function torch()
{
sprTorch.add("lit", [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16], 20, true);
graphic = sprTorch;
sprTorch.play("lit");
}
}
}