Example #1
0
 public Generic(Game game, float x, float y, SpriteTemplate spriteTemplate)
     : base(game,0,"generic")
 {
     X = x;
     Y = y;
     //	_random = (float)Util.Random();
     SpriteTemplate = spriteTemplate;
 }
Example #2
0
        public Explosion(Game game, float x, float y, ExplosionType type)
            : base(game, 0, "explosion")
        {
            X = x;
            Y = y;
            _animSpeed = 4f;
            _type = type;

            switch (_type) {

            case ExplosionType.Smoky:
                _template = new SpriteTemplate () { TilemapName = "units", Rectangle = new Rectangle(0, 832, 96, 96) };
                _frameCount = 16;
                _animSpeed = 4f;
                _lifeTime = -6;
                break;
            }

            _sprite = new Sprite(_template, 0, Priority.Explosion);
            _sprite[0].Angle = (ushort)Util.RandomInt(0,4095);
            _sprite[0].Scale = Util.Random(0.6f, 1.0f);
        }
Example #3
0
 protected SpriteTemplate GetSpriteTemplate(XElement sprite)
 {
     var st = new SpriteTemplate();
     st.TilemapName = "units";
     st.Rectangle.X = (int?)sprite.Attribute("x") ?? st.Rectangle.X;
     st.Rectangle.Y = (int?)sprite.Attribute("y") ?? st.Rectangle.Y;
     st.Rectangle.Width = (int?)sprite.Attribute("w") ?? st.Rectangle.Width;
     st.Rectangle.Height = (int?)sprite.Attribute("h") ?? st.Rectangle.Height;
     st.Offset.X = (int?)sprite.Attribute("cx") ?? st.Offset.X;
     st.Offset.Y = (int?)sprite.Attribute("cy") ?? st.Offset.Y;
     st.Centered = (bool?)sprite.Attribute("center") ?? st.Centered;
     st.FrameOffset = (int?)sprite.Attribute("frameoffset") ?? st.FrameOffset;
     return st;
 }
Example #4
0
 public Sprite(SpriteTemplate st, Flags flags, int priority)
     : base(flags, priority)
 {
     Template = st;
     Add();
 }
Example #5
0
 public Widget(SpriteTemplate template, Game game, int priority)
     : base(template, 0, priority)
 {
     _game = game;
     Add(0,0,1);
 }