Esempio n. 1
0
        public Sprite(string filename, ContentManager Content, Vector2 vec, bool animated = true)
        {
            texture = Content.Load <Texture2D>("Sprites/" + filename);

            this.cameraCoupling = Vector2.Zero;

            this.position = vec;
            if (animated)
            {
                SpriteMetaInfo smi = new SpriteMetaInfo(filename);
                size              = new Vector2(smi.width, smi.height);
                this.animHandler  = new AnimationHandler(smi.height, smi.width, smi.frames, smi.durations, smi.loops);
                boundingRectangle = new Rectangle((int)vec.X, (int)vec.Y, smi.width, smi.height);
            }
            else
            {
                size              = new Vector2(texture.Width, texture.Height);
                this.animHandler  = new AnimationHandler(texture.Height, texture.Width, new List <int>(), new List <int>(), new List <bool>());
                boundingRectangle = new Rectangle((int)vec.X, (int)vec.Y, texture.Width, texture.Height);
            }
            this.animHandler.setAnimation(0, true);
        }
Esempio n. 2
0
		public Sprite (string filename, ContentManager Content, Vector2 vec, bool animated=true)
		{
			texture = Content.Load<Texture2D>("Sprites/" + filename);

            this.cameraCoupling = Vector2.Zero;

			this.position = vec;
            if (animated)
            {
                SpriteMetaInfo smi = new SpriteMetaInfo(filename);
                size = new Vector2(smi.width, smi.height);
                this.animHandler = new AnimationHandler(smi.height, smi.width, smi.frames, smi.durations, smi.loops);
                boundingRectangle = new Rectangle((int)vec.X, (int)vec.Y, smi.width, smi.height);
            }
            else
            {
                size = new Vector2(texture.Width, texture.Height);
                this.animHandler = new AnimationHandler(texture.Height, texture.Width, new List<int>(), new List<int>(), new List<bool>());
                boundingRectangle = new Rectangle((int)vec.X, (int)vec.Y, texture.Width, texture.Height);
            }
            this.animHandler.setAnimation(0, true);
		}