public Sprite(string filename, ContentManager Content, Vector2 vec)
        {
            texture = Content.Load<Texture2D>("Sprites/" + filename);

            hasCollision = true;

            this.position = vec;
            this.animHandler = new AnimationHandler (texture.Height,texture.Width,new List<int>(),new List<int>());
            this.animHandler.setAnimation (0,true);
            boundingRectangle = new Rectangle ((int)vec.X, (int)vec.Y, texture.Width, texture.Height);
        }
Example #2
0
        public Sprite(string filename, ContentManager Content, Vector2 vec, bool animated=true)
        {
            texture = Content.Load<Texture2D>("Sprites/" + filename);

            hasCollision = true;

            this.position = vec;
            if (animated)
            {
                SpriteMetaInfo smi = new SpriteMetaInfo(filename);
                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
            {
                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);
        }
 public void sendAnimationUpdate(AnimationHandler a)
 {
     string m = 'u' + playerId;
     m += a.currentAnimation;
     sendMessage(m);
 }