Esempio n. 1
0
        // must call somewhere
        public static void Init(AssetContext assets)
        {
            breeds = new Dictionary <string, BulletBreed>();

            BulletBreed b = new BulletBreed()
            {
                sprite     = new Sprite(assets.GetTexture("bullet_light_green")),
                startSpeed = Constants.BULLET_START_SPEED,
                textureIntersectionOffset = 30,
                slugLength = 5
            };

            b.sprite.Scale  = new Vector2f(0.5f, 0.5f);
            b.sprite.Origin = new Vector2f(b.sprite.TextureRect.Width - b.textureIntersectionOffset, b.sprite.TextureRect.Height / 2.0f);
            breeds.Add("simple-bullet", b);

            BulletBreed b2 = new BulletBreed()
            {
                sprite     = new Sprite(assets.GetTexture("bullet3")),
                startSpeed = 250,
                textureIntersectionOffset = 1,
                slugLength = 1
            };

            b2.sprite.Scale  = new Vector2f(0.7f, 0.7f);
            b2.sprite.Origin = new Vector2f(b2.sprite.TextureRect.Width, b2.sprite.TextureRect.Height / 2.0f);

            breeds.Add("turret-bullet", b2);
        }
 public static void LoadAnimations(AssetContext assets)
 {
     framesContainer.Add("coins-gold", new AnimationInfo(assets.GetTexture("coins"), getLoopedRow(0, 0, 8, 16, 16), new MyIntRect(0, 0, 16, 16)));
     framesContainer.Add("coins-silver", new AnimationInfo(assets.GetTexture("coins"), getLoopedRow(1, 0, 8, 16, 16), new MyIntRect(0, 0, 16, 16)));
     framesContainer.Add("coins-copper", new AnimationInfo(assets.GetTexture("coins"), getLoopedRow(2, 0, 8, 16, 16), new MyIntRect(0, 0, 16, 16)));
     framesContainer.Add("side-explosion1", new AnimationInfo(assets.GetTexture("side_explosion1"), getLoopedFull(3, 5, 96, 96), new MyIntRect(0, 0, 96, 96)));
     framesContainer.Add("side-explosion2", new AnimationInfo(assets.GetTexture("explosion512"), getLoopedFull(3, 5, 104, 100), new MyIntRect(0, 0, 104, 100)));
     framesContainer.Add("simple-explosion1", new AnimationInfo(assets.GetTexture("explosion32_B"), getLoopedFull(4, 4, 32, 32), new MyIntRect(0, 0, 32, 32)));
     framesContainer.Add("simple-explosion2", new AnimationInfo(assets.GetTexture("explosion32"), getLoopedFull(4, 4, 32, 32), new MyIntRect(0, 0, 32, 32)));
     framesContainer.Add("simple-explosion3", new AnimationInfo(assets.GetTexture("explosion196_C"), getLoopedFull(4, 4, 49, 49), new MyIntRect(0, 0, 49, 49)));
     framesContainer.Add("flash-black", new AnimationInfo(assets.GetTexture("flash_black_128"), getLoopedFull(4, 4, 128, 128), new MyIntRect(0, 0, 128, 128)));
 }
Esempio n. 3
0
        public cSpriteRenderer(string texture_name, MyIntRect texture_rect, AssetContext assets) : base()
        {
            this.sprite = new Sprite(assets.GetTexture(texture_name));

            this.sprite.TextureRect = texture_rect.AsSfmlIntRect();
            //this.sprite.Scale = new Vector2f(0.5f, 0.5f);
            //this.sprite.Rotation = (float)cAppMath.RadianToDegress(this.orientation);

            this.sprite.Origin = new Vector2f(texture_rect.Width / 2.0f, texture_rect.Height / 2.0f);
        }