Exemplo n.º 1
0
 public void Initialize()
 {
     if (TextureName == "")
     {
         _effects = SpriteEffects.None;
         _animator = new Animator();
         Animation.Initialize();
     }
     else
         this.Texture = TextureLoader.GetInstance().GetTexture(TextureName);
 }
Exemplo n.º 2
0
        public void Initialize()
        {
            if (TextureName == "")
            {
                _effects = SpriteEffects.None;
                _animator = new Animator();
                Animation.Initialize();
            }
            else
                this.Texture = TextureLoader.GetInstance().GetTexture(TextureName);

            CollisionBox = new Rectangle((int)Position.X, (int)Position.Y, Texture.Width, Texture.Height);
        }
Exemplo n.º 3
0
        public virtual void Initialize(bool animatedObject)
        {
            ScreenBound = new Rectangle(0, 0, ScreenBoundWidth, ScreenBoundHeight);
            _isAnimatedObject = animatedObject;
            Ground = Position.Y;
            _velocity = Vector2.Zero;
            IsJumping = false;
            _jumpPower = 4.5f;
            _gravity = -6.8f;
            _time = 0;

            if (animatedObject)
            {
                _animator = new Animator();
                _effects = SpriteEffects.None;

                foreach (Animation2 animation2 in States)
                    animation2.Initialize();

                GetAnimation(DefaultState);
                CollisionBox = new Rectangle((int)Position.X, (int)Position.Y, SelectedAnimation.FrameWidth, SelectedAnimation.FrameHeight);
                Texture = SelectedAnimation.Texture;
            }

            _healthBar = new HealthBar();
        }