Game Development Reference
In-Depth Information
AnimatedSprite _testSprite ¼ new AnimatedSprite();public Level(Input
input, TextureManager textureManager, PersistantGameData gameData)
{
_testSprite.Texture ¼ textureManager.Get("explosion");
_testSprite.SetAnimation(4, 4);
// a little later in the code
public void Update(double elapsedTime)
{
_testSprite.Update(elapsedTime);
// a little later in the code
public void Render(Renderer renderer)
{
// Background and other sprite code omitted.
renderer.DrawSprite(_testSprite);
renderer.Render();
}
Running the program and entering a level will now play the explosion animation
once. This confirms everything is working fine (see Figure 10.11).
Figure 10.11
The explosion in the game.
 
Search WWH ::




Custom Search