public Bomb(int playerId, Point cellPosition, int pow, TimeSpan timer, float playerSpeed) : base(playerId, cellPosition, pow, timer, playerSpeed) { // TODO: Move all loading of content into a LoadContent XNA method like // Bomb Sprite var spriteTexture = FinalBomber.Instance.Content.Load<Texture2D>("Graphics/Sprites/bomb"); var animation = new Animation(3, 32, 32, 0, 0, 3); Sprite = new AnimatedSprite(spriteTexture, animation) { IsAnimating = true }; // Bomb's explosion animations _explosionSpriteTexture = FinalBomber.Instance.Content.Load<Texture2D>("Graphics/Sprites/explosion"); const int explosionAnimationsFramesPerSecond = 10; _explosionAnimations = new[] { new Animation(4, 32, 32, 0, 0, explosionAnimationsFramesPerSecond), new Animation(4, 32, 32, 0, 32, explosionAnimationsFramesPerSecond), new Animation(4, 32, 32, 0, 64, explosionAnimationsFramesPerSecond), new Animation(4, 32, 32, 0, 96, explosionAnimationsFramesPerSecond), new Animation(4, 32, 32, 0, 128, explosionAnimationsFramesPerSecond), new Animation(4, 32, 32, 0, 160, explosionAnimationsFramesPerSecond), new Animation(4, 32, 32, 0, 192, explosionAnimationsFramesPerSecond) }; _explosionAnimationsDirection = new Dictionary<Point, ExplosionDirection>(); // Bomb's states _cellTeleporting = false; _lastPlayerThatPushIt = -1; // Sounds _bombExplosionSound = FinalBomber.Instance.Content.Load<SoundEffect>("Audio/Sounds/boom"); }
public Wall(Point cellPosition) : base(cellPosition) { var spriteTexture = FinalBomber.Instance.Content.Load<Texture2D>("Graphics/Sprites/wall"); var animation = new Animation(6, 32, 32, 0, 0, 20) {FramesPerSecond = 20}; Sprite = new AnimatedSprite(spriteTexture, animation); }
public Teleporter(Point cellPosition) : base(cellPosition) { var spriteTexture = FinalBomber.Instance.Content.Load<Texture2D>("Graphics/Sprites/teleporter"); var animation = new Animation(2, 32, 32, 0, 0, 2); Sprite = new AnimatedSprite(spriteTexture, animation) { IsAnimating = true }; _isAlive = true; }
public void LoadContent() { const int animationFramesPerSecond = 10; var animations = new Dictionary<AnimationKey, Animation>(); var animation = new Animation(1, 32, 32, 0, 0, animationFramesPerSecond); animations.Add(AnimationKey.Down, animation); animation = new Animation(1, 32, 32, 0, 32, animationFramesPerSecond); animations.Add(AnimationKey.Left, animation); animation = new Animation(1, 32, 32, 0, 64, animationFramesPerSecond); animations.Add(AnimationKey.Right, animation); animation = new Animation(1, 32, 32, 0, 96, animationFramesPerSecond); animations.Add(AnimationKey.Up, animation); var spriteTexture = FinalBomber.Instance.Content.Load<Texture2D>("Graphics/Sprites/arrow"); Sprite = new AnimatedSprite(spriteTexture, animations) { IsAnimating = true, CurrentAnimation = LookDirectionToAnimationKey(_lookDirection) }; }
private Animation(Animation animation) { this.frames = animation.frames; }
public object Clone() { var animationClone = new Animation(this) { frameWidth = this.frameWidth, frameHeight = this.frameHeight }; animationClone.Reset(); return animationClone; }
private void Initialize() { var animations = new Dictionary<AnimationKey, Animation>(); var animation = new Animation(2, 32, 32, 0, Config.ItemTypeIndex[Type] * 32, 5); var spriteTexture = FinalBomber.Instance.Content.Load<Texture2D>("Graphics/Sprites/item"); Sprite = new AnimatedSprite(spriteTexture, animation) { IsAnimating = true }; var itemDestroyTexture = FinalBomber.Instance.Content.Load<Texture2D>("Graphics/Sprites/itemDestroy"); animation = new Animation(7, 31, 28, 0, 0, 8); _itemDestroyAnimation = new AnimatedSprite(itemDestroyTexture, animation) { IsAnimating = false }; // Sounds _powerUpPickUpSound = FinalBomber.Instance.Content.Load<SoundEffect>("Audio/Sounds/item"); }
public AnimatedSprite(Texture2D sprite, Animation animation) { _texture = sprite; this._animation = animation; _controlable = false; }