/// <summary> /// Deletes the sprite from the buffer /// </summary> public void Delete() { // Go through every string on the sprite for (int i = 0; i < sprite5.Length; i++) { // Delete it from the buffer BufferEditor.Delete(coordinates.X, coordinates.Y + i, sprite5[i]); } }
/// <summary> /// Writes the sprite of the explosion to the buffer /// </summary> /// <returns>If the explosion has finished the animation</returns> public bool Explode() { // Create a bool variable bool retVal = false; // Create a new String array for the sprite string[] sprite = null; // If the timer is not counting if (!timer.IsCounting()) { // Switch the animation frame switch (animation) { // If it's the frame 0 case 0: // Set the sprite to 1 sprite = sprite1; break; // If it's the frame 1 case 1: // Set the sprite to 2 sprite = sprite2; break; // If it's the frame 2 case 2: // Set the sprite to 3 sprite = sprite3; break; // If it's the frame 3 case 3: // If it's a small explosion the animation lasts less time if (type == ExplosionType.SMALL) { // Set the sprite to 5 sprite = sprite5; // Set the return value to true retVal = true; } // Else... else { // Set the sprite to 4 sprite = sprite4; } break; // If it's the frame 4 case 4: // Set the sprite to 5 sprite = sprite5; // Set the return value to true retVal = true; break; } // Increase the animation frame animation++; // Go through every string on the sprite for (int i = 0; i < SPRITE_HEIGHT; i++) { // Write it to the buffer BufferEditor.Write(coordinates.X, coordinates.Y + i, sprite[i]); } } // Return the return value return(retVal); }