Пример #1
0
        public Ghost(float x, float y, bool impostor)
        {
            X = x;
            Y = y;
            Impostor = impostor;

            mySprite = new Spritemap<string>(Assets.GFX_GHOST_SHEET, 22, 20);
            mySprite.Add("idle", new int[] { 0, 1, 2, 3 }, new float[] { 8f });
            mySprite.Add("distort", new int[] { 8, 9, 10 }, new float[] { 1f });
            mySprite.Play("idle");
            mySprite.CenterOrigin();

            mySpeed = new Speed(2);

            Image ghostShadow = new Image(Assets.GFX_SHADOW);
            ghostShadow.CenterOrigin();
            ghostShadow.Alpha = 0.5f;
            AddGraphic(ghostShadow);
            AddGraphic(mySprite);

            AddCollider(new BoxCollider(22, 20, 0));
            Collider.CenterOrigin();
            Layer = 5;

            if(!impostor)
            {
                myController = Global.theController;
            }
        }
Пример #2
0
        public Machine(float x, float y, string machineName, string description, string flav_broke, string flav_fixin, float fixtime, string asset_top, string asset_detail)
        {
            X = x;
            Y = y;
            gfxTop = new Spritemap<string>(asset_top, 64, 64);
            gfxDetail = new Spritemap<string>(asset_detail, 64, 64);
            gfxTop.Add("default", new Anim(new int[] { 0 }, new float[] { 1 }));
            gfxDetail.Add("normal", new Anim(new int[] { 0 }, new float[] { 1 }));
            gfxDetail.Add("broken", new Anim(new int[] { 1 }, new float[] { 1 }));
            gfxDetail.Add("fixing", new Anim(new int[] { 2 }, new float[] { 1 }));

            Name = machineName;
            Description = description;
            FlavBroke = flav_broke;
            FlavFixing = flav_fixin;
            BreakTime = Rand.Float(60 * 5, 60 * 60);
            FixTime = fixtime;
            AddGraphic(gfxTop);
            Graphic.CenterOrigin();
            Status = 1;
            CurTime = Global.theGame.Timer;
            Layer = 31;

            AddCollider(new BoxCollider(32, 32, 6));
            Collider.CenterOrigin();
        }
Пример #3
0
        public Ghost(float x, float y, bool impostor)
        {
            X        = x;
            Y        = y;
            Impostor = impostor;

            mySprite = new Spritemap <string>(Assets.GFX_GHOST_SHEET, 22, 20);
            mySprite.Add("idle", new int[] { 0, 1, 2, 3 }, new float[] { 8f });
            mySprite.Add("distort", new int[] { 8, 9, 10 }, new float[] { 1f });
            mySprite.Play("idle");
            mySprite.CenterOrigin();


            mySpeed = new Speed(2);


            Image ghostShadow = new Image(Assets.GFX_SHADOW);

            ghostShadow.CenterOrigin();
            ghostShadow.Alpha = 0.5f;
            AddGraphic(ghostShadow);
            AddGraphic(mySprite);

            AddCollider(new BoxCollider(22, 20, 0));
            Collider.CenterOrigin();
            Layer = 5;

            if (!impostor)
            {
                myController = Global.theController;
            }
        }
Пример #4
0
        public Airlock(float x, float y, bool vert = true)
        {
            Vert = vert;
            X = x;
            Y = y;
            if(Vert)
            {
                mySprite = new Spritemap<string>(Assets.GFX_AIRLOCKV, 32, 64);
                mySprite.Add("stayclosed", new Anim(new int[] { 0 }, new float[] { 2 }));
                mySprite.Add("open", new Anim(new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }, new float[] { 2 }));
                mySprite.Add("stayopen", new Anim(new int[] { 9 }, new float[] { 2 }));
                mySprite.Add("close", new Anim(new int[] { 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }, new float[] { 2 }));
                AddCollider(new BoxCollider(32, 64, 10));
                Graphic = mySprite;
                //Graphic.CenterOrigin();
                //Collider.CenterOrigin();
            }
            else
            {
                mySprite = new Spritemap<string>(Assets.GFX_AIRLOCKH, 64, 32);
                mySprite.Add("stayclosed", new Anim(new int[] { 0 }, new float[] { 2 }));
                mySprite.Add("open", new Anim(new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }, new float[] { 2 }));
                mySprite.Add("stayopen", new Anim(new int[] { 9 }, new float[] { 2 }));
                mySprite.Add("close", new Anim(new int[] { 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }, new float[] { 2 }));
                AddCollider(new BoxCollider(64, 32, 10));
                Graphic = mySprite;
                //Graphic.CenterOrigin();
                //Collider.CenterOrigin();
            }

            Layer = 22;
        }
Пример #5
0
        public Drone(float x, float y, int hits)
        {
            X = x;
            Y = y;
            mySprite = new Spritemap<string>(Assets.GFX_DRONE, 32, 38);
            mySprite.CenterOrigin();
            mySprite.Add("open", new int[] { 0, 1, 2, 3, 4 }, new float[] { 6f, 6f, 6f, 6f, 24f });
            mySprite.Anim("open").NoRepeat();
            mySprite.Anim("open").OnComplete = this.PlayShineAnim;
            mySprite.Add("shine", new int[] { 5, 6, 7, 8, 9, 10, 11 }, new float[] { 3f });
            mySprite.Anim("shine").NoRepeat();
            mySprite.Anim("shine").OnComplete = this.ChargeUpLaser;
            mySprite.Add("charge", new int[] { 12, 13 }, new float[] { 8f });
            mySprite.Add("fire", new int[] { 14, 15 }, new float[] { 1f });
            mySprite.Add("dead", new int[] { 16, 17, 18, 19, 20 }, new float[] { 10f, 4f, 4f, 4f, 4f });
            mySprite.Anim("dead").NoRepeat();
            mySprite.Anim("dead").OnComplete = this.StopShaking;
            mySprite.Play("open");
            mySprite.FlippedX = Rand.Bool;

            Image ghostShadow = new Image(Assets.GFX_SHADOW);
            ghostShadow.CenterOrigin();
            ghostShadow.OriginY -= 25;
            ghostShadow.Alpha = 0.5f;
            AddGraphic(ghostShadow);
            AddGraphic(mySprite);

            MaxChargeTime = Rand.Float(60.0f, 240.0f);

            AddCollider(new BoxCollider(32, 38, 2));
            Collider.CenterOrigin();
        }
Пример #6
0
 public Hover(float x, float y) : base(x, y)
 {
     spritemap.Add(Animation.Idle, "0", 4);
     spritemap.Add(Animation.Shoot, "0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33", 2);
     spritemap.CenterOrigin();
     spritemap.Play(Animation.Shoot);
     AddGraphic(spritemap);
     scene.Add(this);
     fire = scene.random.Next(60 * 2, 60 * 3);
 }
Пример #7
0
 public Rocket(float x, float y, Random random, Sound Sound) : base(x, y)
 {
     spritemap = new Spritemap <Animation>("Assets/Img/rocket.png", 124, 110);
     spritemap.Add(Animation.Shoot, "0,1,2,3,4,5,6,7, 8,9,10,8,9,10,8,9,10,8,9,10,8,9,10,8,9,10,8,9,10,8,9,10,8,9,10,8,9,10, 11,12,13,14,15,16,11,12,13,14,15,16,11,12,13,14,15,16,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26, 27,28,29,30,31,32,33,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,", 4).NoRepeat();
     spritemap.Add(Animation.Idle, "0", 4).NoRepeat();
     this.random = random;
     this.Sound  = Sound;
     spritemap.CenterOrigin();
     spritemap.Play(Animation.Idle);
     AddGraphic(spritemap);
 }
Пример #8
0
 public Mortar(float x, float y, Random random, Sound Sound) : base(x, y)
 {
     spritemap = new Spritemap <Animation>("Assets/Img/mortar2.png", 53, 54);
     spritemap.Add(Animation.Shoot, "18,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18", 4).NoRepeat();
     spritemap.Add(Animation.Idle, "18", 4).NoRepeat();
     this.random = random;
     this.Sound  = Sound;
     spritemap.CenterOrigin();
     spritemap.Play(Animation.Idle);
     AddGraphic(spritemap);
 }
Пример #9
0
        protected Point a; //acceleration


        public Player(float x, float y)
            : base(x, y, playerSprite)
        {
            playerSprite.Add("stand", new int[] { 0, 1, 2, 3, 4, 5 }, 0, true);
            playerSprite.Add("run", new int[] { 6, 7, 8, 9, 10, 11 }, 0, true);

            setHitbox(48, 32);

            v = new Point();
            a = new Point();
        }
Пример #10
0
 public IronIso(float x, float y, Random random, Sound Sound) : base(x, y)
 {
     spritemap = new Spritemap <Animation>("Assets/Img/iron_iso.png", 148, 78);
     spritemap.Add(Animation.Shoot, "0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17", 4).NoRepeat();
     spritemap.Add(Animation.Idle, "0", 4).NoRepeat();
     this.random = random;
     this.Sound  = Sound;
     spritemap.CenterOrigin();
     spritemap.Play(Animation.Idle);
     AddGraphic(spritemap);
 }
Пример #11
0
 public Soldier(float x, float y) : base(x, y)
 {
     spritemap.Add(Animation.Idle, scene.GetAnimationString(0, 0), 5).NoRepeat();
     spritemap.Add(Animation.Throw, scene.GetAnimationString(0, 11), 4).NoRepeat();
     spritemap.CenterOrigin();
     spritemap.Play(Animation.Idle);
     runtime = (int)spritemap.Anim(Animation.Idle).TotalDuration *scene.random.Next(3, 4);
     AddGraphic(spritemap);
     scene.Add(this);
     SetHitbox(43, 42, ColliderTags.Garbage);
     Hitbox.CenterOrigin();
 }
Пример #12
0
 public BiggestTonk(float x, float y) : base(x, y)
 {
     spritemap.Add(Animation.Idle, "0", 4);
     spritemap.Add(Animation.Shoot, "0-16", 4).NoRepeat();
     spritemap.CenterOrigin();
     spritemap.Play(Animation.Idle);
     AddGraphic(spritemap);
     cooldown = scene.random.Next(60 * 2, 60 * 3);
     scene.Add(this);
     SetHitbox(187, 80, ColliderTags.Garbage);
     Hitbox.CenterOrigin();
 }
Пример #13
0
 public Turret(float x, float y) : base(x, y)
 {
     spritemap.Add(Animation.Idle, "0, 1", 4);
     spritemap.Add(Animation.Shoot, "2-17", 4).NoRepeat();
     spritemap.CenterOrigin();
     spritemap.Play(Animation.Idle);
     AddGraphic(spritemap);
     scene.Add(this);
     cooldown = scene.random.Next(2 * 60, 3 * 60);
     SetHitbox(170, 80, ColliderTags.Garbage);
     Hitbox.CenterOrigin();
 }
Пример #14
0
 public Sniper(float x, float y) : base(x, y)
 {
     spritemap.Add(Animation.Idle, "0", 4);
     spritemap.Add(Animation.Shoot, "0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22", 3).NoRepeat();
     spritemap.CenterOrigin();
     spritemap.Play(Animation.Idle);
     AddGraphic(spritemap);
     cooldown = scene.random.Next(60 * 2, 60 * 3);
     scene.Add(this);
     SetHitbox(66, 27, ColliderTags.Garbage);
     Hitbox.CenterOrigin();
 }
Пример #15
0
 public FatTonk(float x, float y) : base(x, y)
 {
     spritemap.Add(Animation.Idle, "0, 1", 4);
     spritemap.Add(Animation.Shoot, "2-17", 4).NoRepeat();
     spritemap.CenterOrigin();
     spritemap.Play(Animation.Idle);
     AddGraphic(spritemap);
     cooldown = scene.random.Next(60 * 1, 60 * 2);
     scene.Add(this);
     SetHitbox(130, 62, ColliderTags.Garbage);
     Hitbox.CenterOrigin();
 }
Пример #16
0
 public Rocket(float x, float y) : base(x, y)
 {
     spritemap.Add(Animation.Idle, "0", 4);
     spritemap.Add(Animation.Shoot, "0,1,2,3,4,5,6,7, 8,9,10,8,9,10,8,9,10,8,9,10,8,9,10,8,9,10,8,9,10,8,9,10,8,9,10,8,9,10, 11,12,13,14,15,16,11,12,13,14,15,16,11,12,13,14,15,16,11,12,13,14,15,16, 17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34", 4).NoRepeat();
     spritemap.CenterOrigin();
     spritemap.Play(Animation.Idle);
     AddGraphic(spritemap);
     cooldown = scene.random.Next(60 * 4, 60 * 5);
     scene.Add(this);
     SetHitbox(124, 110, ColliderTags.Garbage);
     Hitbox.CenterOrigin();
 }
Пример #17
0
 public Minigun(float x, float y) : base(x, y)
 {
     spritemap.Add(Animation.Idle, "0, 1, 2, 3", 4);
     spritemap.Add(Animation.Shoot, "4-20", 4).NoRepeat();
     spritemap.CenterOrigin();
     spritemap.Play(Animation.Idle);
     AddGraphic(spritemap);
     scene.Add(this);
     this.cooldown = scene.random.Next(60 * 4, 60 * 6);
     SetHitbox(128, 63, ColliderTags.Garbage);
     Hitbox.CenterOrigin();
 }
Пример #18
0
 public Mortar(float x, float y) : base(x, y)
 {
     spritemap.Add(Animation.Idle, "0", 4);
     spritemap.Add(Animation.Shoot, "0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13", 4).NoRepeat();
     spritemap.CenterOrigin();
     spritemap.Play(Animation.Idle);
     AddGraphic(spritemap);
     cooldown = scene.random.Next(60 * 1, 60 * 2);
     scene.Add(this);
     SetHitbox(40, 42, ColliderTags.Garbage);
     Hitbox.CenterOrigin();
 }
Пример #19
0
 public Chest(float x, float y) : base(x, y)
 {
     SetHitbox(21, 23, ColliderTags.EnemyUnit);
     Hitbox.SetPosition(6, 5);
     this.prize = scene.stage.GetTreasureGold();
     spritemap.Add(Animation.Open, "6-9", 4).NoRepeat();
     spritemap.Add(Animation.Close, "9-6", 4).NoRepeat();
     spritemap.Add(Animation.Idle, "0-5", 4);
     spritemap.Play(Animation.Idle);
     AddGraphic(spritemap);
     scene.Add(this);
 }
Пример #20
0
 public Player1(float x, float y) : base(x, y)
 {
     spritemap.Add(Animation.WalkUp, "13", 1);
     spritemap.Add(Animation.WalkRight, "9", 1);
     spritemap.Add(Animation.WalkDown, "0", 1);
     spritemap.Add(Animation.WalkLeft, "5", 1);
     spritemap.Add(Animation.Attack, "17, 0", 15).NoRepeat();
     spritemap.CenterOrigin();
     spritemap.Play(Animation.WalkDown);
     AddGraphic(spritemap);
     AddCollider(c);
     c.CenterOrigin();
 }
Пример #21
0
 public Player2(float x, float y) : base(x, y)
 {
     spritemap2.Add(Animation.WalkUp, "4", 1);
     spritemap2.Add(Animation.WalkDown, "1", 1);
     spritemap2.Add(Animation.WalkRight, "10", 1);
     spritemap2.Add(Animation.WalkLeft, "7", 1);
     spritemap2.Add(Animation.Attack, "28, 1", 15).NoRepeat();
     spritemap2.CenterOrigin();
     spritemap2.Play(Animation.WalkDown);
     AddGraphic(spritemap2);
     AddCollider(c);
     c.CenterOrigin();
 }
Пример #22
0
        public Player(float x = 0, float y = 0)
        {
            // When creating a new player, the desired X,Y coordinates are passed in. If excluded, we start at 0,0
            X = x;
            Y = y;
            // Create a new spritemap, with the player.png image as our source, 32 pixels wide, and 40 pixels tall
            sprite = new Spritemap <string>(Assets.PLAYER, 32, 40);

            // We must define each animation for our spritemap.
            // An animation is made up of a group of frames, ranging from 1 frame to many frames.
            // Each 32x40 box is a single frame in our particular sprite map.
            // The frames start counting from 0, and count from left-to-right, top-to-bottom
            sprite.Add("standLeft", new int[] { 0, 1 }, new float[] { 10f, 10f });
            sprite.Add("standRight", new int[] { 0, 1 }, new float[] { 10f, 10f });
            sprite.Add("standDown", new int[] { 3, 4 }, new float[] { 10f, 10f });
            sprite.Add("standUp", new int[] { 6, 7 }, new float[] { 10f, 10f });
            sprite.Add("walkLeft", new int[] { 0, 1 }, new float[] { 10f, 10f });
            sprite.Add("walkRight", new int[] { 0, 1 }, new float[] { 10f, 10f });
            sprite.Add("walkDown", new int[] { 3, 4 }, new float[] { 10f, 10f });
            sprite.Add("walkUp", new int[] { 6, 7 }, new float[] { 10f, 10f });

            // Tell the spritemap which animation to play when the scene starts
            sprite.Play("standDown");

            // Lastly, we must set our Entity's graphic, otherwise it will not display
            Graphic = sprite;
        }
Пример #23
0
        public AnimatedEntity(string entityName, string twitchHeadName, bool isAvatar, string twitchUseranme, Color tintColor)
        {
            string EntityFilePath = Utility.CONTENT_DIR + "/entities/" + entityName;

            AnimatedEntityData = JsonLoader.Load <AnimatedEntityData>(EntityFilePath);
            var defaultAnim = AnimatedEntityData.Animations[AnimatedEntityData.DefaultAnimation];

            Sprite = new Spritemap(Library.GetTexture(EntityFilePath + ".png"), defaultAnim.FrameWidth, defaultAnim.FrameHeight)
            {
                OriginX = defaultAnim.OriginX,
                OriginY = defaultAnim.OriginY
            };

            foreach (var animation in AnimatedEntityData.Animations.Values)
            {
                Sprite.Add(animation.Name, animation.Frames, animation.FPS, true);
            }

            if (AnimatedEntityData.ShaderName != null)
            {
                Shader shader = new Shader(Shader.ShaderType.Fragment, Library.GetText("content/shaders/" + AnimatedEntityData.ShaderName));
                Sprite.Shader = shader;
                //chromaKey.SetAsCurrentTexture("sampler2D");
                shader.SetParameter("color", tintColor);
            }

            Sprite.Play(AnimatedEntityData.DefaultAnimation);
            AddComponent(Sprite);

            CreateHead(twitchHeadName, isAvatar);
            CreateName(twitchUseranme);
        }
Пример #24
0
        /*public static Dictionary<string, AnimationData> projDict = new Dictionary<string, AnimationData>()
         * {
         *      { "Bubble", new AnimationData (2, FP.Frames(1,2,3), false, null)},
         *      { "BubbleLoop", new AnimationData (2, FP.Frames(4,5,6), true, null)},
         *      { "BubblePop", new AnimationData (1, FP.Frames(7), false, null)},
         *      { "Bananarang", new AnimationData (2, FP.Frames(8,9,10), true, null)},
         *      { "Card", new AnimationData (2, FP.Frames(11,12), true, null)},
         *      { "Fireball", new AnimationData (2, FP.Frames(13, 14), true, null)},
         *      { "Shell", new AnimationData (3, FP.Frames(15,16), true, null)},
         *      { "Yarn", new AnimationData (1, FP.Frames(17), true, null)},
         *      { "Shuriken", new AnimationData (1, FP.Frames(18,19), true, null)},
         *      { "ElecBall", new AnimationData (2, FP.Frames(20), true, null)},
         *      { "Key", new AnimationData (1, FP.Frames(21), true, null)},
         *      { "Lightning", new AnimationData (1, FP.Frames(22,23), true, null)},
         *      { "Egg", new AnimationData (1, FP.Frames(24), true, null)},
         *      { "Arrow", new AnimationData (1, FP.Frames(25), true, null)}
         * };*/

        static Hat()
        {
            foreach (var entry in hatDict)
            {
                hatmap.Add(entry.Key, entry.Value.frames, entry.Value.fps, entry.Value.loop);
            }
        }
Пример #25
0
 public Enemy_Mummy(float x, float y) : base(x, y)
 {
     Layer          = -500;
     this.MaxHP     = scene.stage.MaxHP;
     this.CurrentHP = this.MaxHP;
     SetHitbox(35, 46, ColliderTags.EnemyUnit);
     Hitbox.SetPosition(9, 17);
     spritemap.Add(Animation.Shoot, scene.GetAnimationString(0, 21), 3).NoRepeat();
     spritemap.Add(Animation.Death, scene.GetAnimationString(22, 67), 3).NoRepeat();
     spritemap.Add(Animation.Run, scene.GetAnimationString(68, 85), 3);
     spritemap.Play(Animation.Run);
     AddGraphic(spritemap);
     scene.Add(this);
     scene.enemyList.Add(this);
     runtime = (int)spritemap.Anim(Animation.Run).TotalDuration *scene.random.Next(3, 12);
 }
Пример #26
0
        public override void Load(System.Xml.XmlNode node)
        {
            base.Load(node);

            cloak = new Spritemap(Library.GetTexture("assets/ArmsBosslowres.png"), 674 / 2, 349 / 2, onAnimationEnd);
            cloak.Add("Idle", FP.Frames(0), 1, true);
            cloak.Add("Reveal", FP.MakeFrames(0, 11), 5, false);

            AddGraphic(cloak);

            cloak.Scale   = 4;
            cloak.OriginX = 673 / 8 - 15;
            cloak.OriginY = 349 / 4;

            cloak.Play("Idle");
        }
Пример #27
0
 public Monster1Blue(float x = 0, float y = 0)
     : base(baseSpeed:600)
 {
     X = x;
     Y = y;
     HurtSound = new Sound(Resources.Sound.Monsters.BASIC_ENEMY_HIT);
     HurtSound.Volume = 0.1f;
     DeathSound = new Sound(Resources.Sound.Monsters.BASIC_ENEMY_EXPLOSION);
     DeathSound.Volume = 0.7f;
     Sprite = new Spritemap<string>(Resources.Sprites.Monsters.ENEMY_1_BLUE, 46, 46);
     Sprite.Add("walk", new int[] { 0, 1, 2, 3, 4, 5 }, new float[] { 10f, 2f, 1f, 10f, 2f, 1f });
     Sprite.Play("walk");
     Graphic = Sprite;
     Graphic.CenterOrigin();
     Health = new Life(10);
     Health.OnDeath = OnDeath;
     Health.OnHurt = OnHurt;
     Direction = Vector2.Zero;
     var c = new LinkedListNode<Vector2>(new Vector2(50.0f, 50.0f));
     var t = new LinkedList<Vector2>();
     Path = c;
     t.AddLast(c);
     t.AddLast(new Vector2(Global.GAME.Width - 50.0f, 50.0f));
     t.AddLast(new Vector2(Global.GAME.Width - 50.0f, Global.GAME.Height - 50.0f));
     t.AddLast(new Vector2(50, Global.GAME.Height - 50.0f));
     AddComponent(new CheckPointMovement(this, Path));
     AddComponent(new Rotation(this, 90));
     AddComponent(Health);
     SetHitbox(23, 23, Global.HitBoxTag.Enemy);
 }
Пример #28
0
        public BossArms()
        {
            arms = new Spritemap(Library.GetTexture("assets/Arms.png"), 256, 256, null);
            arms.Add("Idle", FP.Frames(0), 1, true);
            arms.Add("Attack", FP.Frames(0, 1), 4, false);

            arms.OriginX = 128;
            arms.OriginY = 128;

            AddGraphic(arms);

            SetHitbox(256, 256, 128, 128);

            Type = "enemy";

            arms.Play("Idle");
        }
Пример #29
0
 public Enemy_Cokka(float x, float y) : base(x, y)
 {
     Layer          = -500;
     this.MaxHP     = scene.stage.MaxHP * 2;
     this.CurrentHP = this.MaxHP;
     SetHitbox(72, 57, ColliderTags.EnemyUnit);
     Hitbox.SetPosition(12, 20);
     spritemap.Add(Animation.Shoot, scene.GetAnimationString(0, 16), 4).NoRepeat();
     spritemap.Add(Animation.Death, scene.GetAnimationString(17, 25), 4).NoRepeat();
     spritemap.Add(Animation.WeaponOut, scene.GetAnimationString(32, 38), 4).NoRepeat();
     spritemap.Add(Animation.Run, scene.GetAnimationString(26, 31), 4);
     spritemap.Play(Animation.Run);
     AddGraphic(spritemap);
     scene.Add(this);
     scene.enemyList.Add(this);
     runtime = (int)spritemap.Anim(Animation.Run).TotalDuration *scene.random.Next(3, 12);
 }
Пример #30
0
        void initSpriteMap()
        {
            pAssets.Add(pAnim.top, "0,1,2", "8");
            pAssets.Add(pAnim.left, "3,4,5", "8");
            pAssets.Add(pAnim.down, "6,7,8", "8");
            pAssets.Add(pAnim.right, "9,10,11", "8");
            pAssets.Add(pAnim.idle, "0", "4");
            Console.WriteLine("SpriteMap CHODZENIA załadoway!");
            pAssets.Play(pAnim.idle);

            pSAssets.Add(pShoot.down, "0,1,0", "8").NoRepeat();
            pSAssets.Add(pShoot.top, "4,5,4", "8").NoRepeat();
            pSAssets.Add(pShoot.left, "2,3,2", "8").NoRepeat();
            pSAssets.Add(pShoot.right, "6,7,6", "8").NoRepeat();
            pSAssets.Add(pShoot.idle, "0", "1");
            pSAssets.Play(pShoot.idle);
            Console.WriteLine("SpriteMap STRZELANIA załadoway!");
        }
Пример #31
0
        public BulletTrail(float x, float y) : base(x, y)
        {
            destroyFrame = DESTROY_FRAME;

            sprite = new Spritemap <string>(Assets.BULLET_PARTICLE, 32, 40);
            sprite.Add("Emit", new int[] { 0, 1, 2, 3 }, new float[] { 10f, 10f, 10f, 10f });
            sprite.Play("Emit");
            Graphic = sprite;
        }
Пример #32
0
 public Soldier(float x, float y, Random random, Sound Sound) : base(x, y)
 {
     spritemap = new Spritemap <Animation>("Assets/Img/soldier.png", 64, 29);
     spritemap.Add(Animation.Shoot, "0,1,2,3", 4);
     this.random = random;
     this.Sound  = Sound;
     spritemap.CenterOrigin();
     spritemap.Play(Animation.Shoot);
     AddGraphic(spritemap);
 }
Пример #33
0
 public Heli(float x, float y) : base(x, y)
 {
     spritemap.Add(Animation.Idle, "0-15", 1);
     spritemap.CenterOrigin();
     spritemap.Play(Animation.Idle);
     AddGraphic(spritemap);
     cooldown = 40;
     scene.Add(this);
     fire = scene.random.Next(60 * 1, 60 * 2);
 }
Пример #34
0
 public Heli(float x, float y, Random random, Sound Sound) : base(x, y)
 {
     spritemap = new Spritemap <Animation>("Assets/Img/heli.png", 88, 91);
     spritemap.Add(Animation.Shoot, "0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15", 4);
     this.random = random;
     this.Sound  = Sound;
     spritemap.CenterOrigin();
     spritemap.Play(Animation.Shoot);
     AddGraphic(spritemap);
 }
Пример #35
0
 public Enemy_high_tonk(float x, float y) : base(x, y)
 {
     Layer          = -500;
     this.MaxHP     = scene.stage.MaxHP * 4;
     this.CurrentHP = this.MaxHP;
     SetHitbox(72, 97, ColliderTags.EnemyUnit);
     Hitbox.SetPosition(40, 10);
     spritemap.Add(Animation.Death, "43, 44, 45, 0", 8).NoRepeat();
     spritemap.Add(Animation.Run, "1-6", 4);
     spritemap.Add(Animation.Idle, "7, 8", 4);
     spritemap.Add(Animation.Shoot, "19-35,9-18", 4).NoRepeat();
     //spritemap.Add(Animation.Shoot, "9-35", 4).NoRepeat();
     spritemap.Add(Animation.Stop, "36-42", 4).NoRepeat();
     spritemap.Play(Animation.Run);
     AddGraphic(spritemap);
     scene.Add(this);
     scene.enemyList.Add(this);
     runtime = (int)spritemap.Anim(Animation.Run).TotalDuration *scene.random.Next(3, 12);
 }
Пример #36
0
        public Player(float x, float y)
        {
            X = x;
            Y = y;
            // load player sheet
            mySprite = new Spritemap<string>(Assets.GFX_PLAYER, 32, 32);
            mySprite.Add("idle", new int[] { 0 }, new float[] { 60.0f });
            mySprite.Add("run", new int[] { 0, 1, 2, 3, 4, 5 }, new float[] { 6f, 6f, 6f, 6f, 6f, 6f });
            mySprite.Add("dead", new int[] { 6 }, new float[] { 6f });
            mySprite.Play("run");
            mySprite.CenterOrigin();
            AddGraphic(mySprite);
            mySpeed = new Speed(5);

            // Load inventory images
            hand = new Image(Assets.GFX_HAND);
            boots = new Image(Assets.GFX_BOOTS);
            circuit = new Image(Assets.GFX_CIRCUIT);
            wrench = new Image(Assets.GFX_WRENCH);
            crisps = new Image(Assets.GFX_CRISPS);
            donut = new Image(Assets.GFX_DONUT);
            o2tank = new Image(Assets.GFX_O2TANK);
            fireextinguisher = new Image(Assets.GFX_EXTINGUISHER);
            battery = new Image(Assets.GFX_BATTERY);
            tiles = new Image(Assets.GFX_TILE);

            StartInspect = Global.theGame.Timer;

            AddCollider(new CircleCollider(8, 2));
            Collider.CenterOrigin();

            crossHair = new Entity(X, Y, new Image(Assets.XHAIR));
            crossHair.Graphic.CenterOrigin();
            crossHair.AddCollider(new CircleCollider(8, 4));
            crossHair.Collider.CenterOrigin();

            // Default vars
            NoShoes = false;
            HP = 100;
            O2Level = 100;
            Hunger = 0;
            InsideShip = true;
        }
Пример #37
0
 public BasicBulletExplosionParticle(float x, float y)
     : base(x, y)
 {
     EndFrame = 3;
     Sprite = new Spritemap<string>(Resources.Sprites.Turrets.TOWER_BULLET_EXPLOSION, 32, 40);
     Sprite.Add("Emit", new int[] { 0, 1, 2, 3 }, new float[] { 10f, 10f, 10f, 10f }).NoRepeat();
     Graphic = Sprite;
     Graphic.CenterOrigin();
     Sprite.Play("Emit");
 }
Пример #38
0
 public MonsterExplosionParticle(float x, float y)
     : base(x, y)
 {
     EndFrame = 23;
     Sprite = new Spritemap<string>(Resources.Sprites.Monsters.ENEMY_EXPLOSION, 130, 130);
     //Sprite.Shader = new Shader(Resources.Shaders.BLAST_SHADER);
     Sprite.Add("explode", new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23 }, new float[] { 0.1f, 0.1f, 0.2f, 0.2f, 0.2f, 0.2f, 0.2f, 0.2f, 0.2f, 0.2f, 0.3f, 0.3f, 0.4f, 0.5f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f }).NoRepeat();
     Sprite.Play("explode");
     Graphic = Sprite;
     Graphic.CenterOrigin();
 }
Пример #39
0
 public void Break()
 {
     Status = 2;
     Spritemap<string> newMap = new Spritemap<string>(Assets.GFX_FIRE, 64, 64);
     newMap.Add("fire", new Anim(new int[] { 0, 1, 2, 3, 4 }, new float[] { 3f }));
     newMap.Play("fire");
     myFire = new Entity(X, Y, newMap);
     myFire.Graphic.CenterOrigin();
     myFire.Graphic.Shake = 4;
     myFire.Layer = 20;
     this.Scene.Add(myFire);
 }
Пример #40
0
        public HeroEntity()
        {
            var deathTexture = new Texture(DeathAnimationPath);
            _deathSpriteMap = new Spritemap<string>(deathTexture, 256, 256);
            _deathSpriteMap.Add("Dying", new[] {0, 1}, new float[] {5, 5});
            _deathSpriteMap.Y -= 37;
            _deathSpriteMap.X -= 40;

            _heroImage.X -= 28;
            _heroImage.Y -= 20;

            Spawn();

            _hitBox.CenterOrigin();

            X = Game.Instance.HalfWidth;
            Y = Game.Instance.Height - 75;
        }
Пример #41
0
        public Star(float x, float y, float xspd, float yspd)
        {
            X = x;
            Y = y - 10;
            XSpeed = xspd;
            YSpeed = yspd;

            LifeSpan = 60.0f;

            Spritemap<string> myGfx = new Spritemap<string>(Assets.GFX_STAR, 20, 19);
            myGfx.Add("default", new int[] {0, 1, 2, 3}, new float[] {1f});
            myGfx.Play("default");
            myGfx.Smooth = false;
            myGfx.CenterOrigin();
            //myGfx.Angle = Otter.Rand.Float(-180.0f, 180.0f);
            AddGraphic(myGfx);

            AddCollider(new BoxCollider(20, 19, 1));
            Collider.CenterOrigin();
        }
Пример #42
0
        public MissileEntity(float x, float y, BulletDirection bulletDirection)
        {
            _bulletDirection = bulletDirection;

            var projectilePath = (bulletDirection == BulletDirection.Up)
                ? @".\Assets\Graphics\PlayerProjectile256.png"
                : @".\Assets\Graphics\AlienProjectile256.png";
            var animation = new Spritemap<string>(projectilePath, 256, 256);

            animation.Add("firing", new[] { 0, 1 }, new[] { 5f, 5f });

            animation.Play("firing");
            SetGraphic(animation);
            SetCollider(_hitBox);

            animation.OriginX = 0;
            animation.OriginY = 0;

            X = x;
            Y = y;
        }
Пример #43
0
        public Ship()
        {
            // Create Graphics
            myShipSprite = new Spritemap<string>(Assets.SHIP_GFX_TEST, 33, 33);
            myShipSprite.Add("ship", new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }, new float[] { 2f });
            myShipSprite.Play("ship");
            myShipSprite.CurrentFrame = 0;

            myFlameSprite = new Spritemap<string>(Assets.SHIP_GFX_TEST_FLAME, 33, 33);
            myFlameSprite.Add("ship", new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }, new float[] { 2f });
            myFlameSprite.Play("ship");
            myFlameSprite.CurrentFrame = 0;
            myFlameSprite.CenterOrigin();

            Graphic = myShipSprite;
            Graphics.Add(myFlameSprite);
            Graphic.CenterOrigin();

            // Create Components
            myMovement = new ShipMovement(128 * 20, 128 * 20, EnginePower);
            myShipController = new ShipController(this);
            AddComponent(myMovement);
        }
Пример #44
0
        private void Initialize()
        {
            this.SetHitbox(30, 30, new[] { (int)CollisionTag.Player });

            _bomberImages = new Spritemap<string>("Assets/Images/player.png", Global.GridSize, Global.GridSize);
            _bomberImages.Add("standDown", new int[] { 2 }, new int[] { 10 });
            _bomberImages.Add("standUp", new int[] { 3 }, new int[] { 10 });
            _bomberImages.Add("standRight", new int[] { 6 }, new int[] { 10 });
            _bomberImages.Add("standLeft", new int[] { 6 }, new int[] { 10 });

            _bomberImages.Add("walkDown", new int[] { 1, 2 }, new int[] { 10, 10 });
            _bomberImages.Add("walkUp", new int[] { 4, 5 }, new int[] { 10, 10 });
            _bomberImages.Add("walkRight", new[] { 7, 8 }, new int[] { 10, 10 });
            _bomberImages.Add("walkLeft", new[] { 7, 8 }, new int[] { 10, 10 });
            _bomberImages.Play("standDown");

            this.Graphic = this._bomberImages;

            this.Speed = 250;
            this.BombsAvailable = 1;

            this.Session.Controller = Controller.Get360Controller(Session.Id);
            //Directionals
            this.Session.Controller.AxisDPad.AddKey(Key.W, Direction.Up);
            this.Session.Controller.AxisDPad.AddKey(Key.A, Direction.Left);
            this.Session.Controller.AxisDPad.AddKey(Key.S, Direction.Down);
            this.Session.Controller.AxisDPad.AddKey(Key.D, Direction.Right);

            this.Session.Controller.AxisLeft.AddKey(Key.W, Direction.Up);
            this.Session.Controller.AxisLeft.AddKey(Key.A, Direction.Left);
            this.Session.Controller.AxisLeft.AddKey(Key.S, Direction.Down);
            this.Session.Controller.AxisLeft.AddKey(Key.D, Direction.Right);

            //Bombing
            this.Session.Controller.B.AddKey(Key.Space);

            this.Movement = new BasicMovement(this.Speed, this.Speed, 50);
            this.Movement.Collider = this.Hitbox;
            this.Movement.Axis = this.Session.Controller.AxisDPad;

            this.Movement.AddCollision((int)CollisionTag.Brick);
            this.Movement.AddCollision((int)CollisionTag.Bomb);
            this.Movement.AddCollision((int)CollisionTag.Wall);
            this.Movement.AddCollision((int)CollisionTag.Player);

            Image color = Image.CreateRectangle(Global.GridSize, this.Color);
            color.Blend = BlendMode.Multiply;
            this.Graphics.Add(color);

            this.AddComponent(this.Movement);
            this.AddCollider(this.Hitbox);
        }
Пример #45
0
 protected void SetUpSpriteMap(string path)
 {
     var spriteMap = new Spritemap<string>(path, 256, 256);
     spriteMap.Add("Invading", new[] { 0, 1 }, new[] { 20f, 20f });
     spriteMap.Play("Invading");
     SetGraphic(spriteMap);
 }