예제 #1
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();
        }
예제 #2
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;
        }
예제 #3
0
파일: Machine.cs 프로젝트: DrMelon/AGDSJam1
        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();
        }
예제 #4
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);
 }
예제 #5
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);
        }
예제 #6
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;
            }
        }
예제 #7
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;
            }
        }
예제 #8
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;
        }
예제 #9
0
        public void NodeHandler(XmlNode entity)
        {
            switch (entity.Name)
            {
            default:
            case "EnemyWalker":
            {
                this.spritemap = SpritemapConstructor.makeWalker();
                this.SetHitbox(spritemap.Width, spritemap.Height, (int)spritemap.OriginX, (int)spritemap.OriginY);
                this.ai   = new AIWalker(GameWorld.World, this, int.Parse(entity.Attributes["speed"].Value));
                this.Type = KQ.CollisionTypeEnemy;
                this.AddComponent <Image>(this.spritemap);
                break;
            }

            case "EnemyCrawler":
            {
                this.spritemap = SpritemapConstructor.makeWalker();
                this.SetHitbox(spritemap.Width, spritemap.Height, (int)spritemap.OriginX, (int)spritemap.OriginY);
                this.ai   = new AICrawler(GameWorld.World, this, int.Parse(entity.Attributes["speed"].Value));
                this.Type = KQ.CollisionTypeEnemy;
                this.AddComponent <Image>(this.spritemap);
                break;
            }
            }
        }
예제 #10
0
        public Enemy(Spritemap spritemap, IAI ai, float x, float y)
            : base(x, y)
        {
            this.spritemap = spritemap;
            this.ai        = ai;
            this.AddComponent <Image>(this.spritemap);

            this.touchDamage = 15;
        }
예제 #11
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;
        }
예제 #12
0
파일: Program.cs 프로젝트: oLaudix/IdleGame
 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);
 }
예제 #13
0
파일: Program.cs 프로젝트: oLaudix/IdleGame
 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);
 }
 public MonsterTargetBullet(Vector2 position, Monster target, int damage) : base(damage:damage, baseSpeed:3000)
 {
     X = position.X;
     Y = position.Y;
     BulletImage = new Spritemap<string>(Resources.Sprites.Bullets.BULLET_RED_1_1, 12, 12);
     Graphic = BulletImage;
     Graphic.CenterOrigin();
     AddComponent(new ToMonsterMovement(this, target));
     SetHitbox(1, 1, Global.HitBoxTag.Bullet);
 }
예제 #15
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");
 }
예제 #16
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();
 }
예제 #17
0
파일: Program.cs 프로젝트: oLaudix/IdleGame
 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);
 }
예제 #18
0
 public StraightMovementBullet(Vector2 position, Vector2 direction) : base(damage:4, baseSpeed:1000)
 {
     X = position.X;
     Y = position.Y;
     BulletImage = new Spritemap<string>(Resources.Sprites.Bullets.BULLET_GREEN_1_1, 12, 12);
     LifeSpan = 60;
     Graphic = BulletImage;
     Graphic.CenterOrigin();
     AddComponent(new StraightMovement(this));
     SetHitbox(16, 14, Global.HitBoxTag.Bullet);
 }
예제 #19
0
파일: Program.cs 프로젝트: oLaudix/IdleGame
 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);
 }
예제 #20
0
파일: Program.cs 프로젝트: oLaudix/IdleGame
        public Minigun(float x, float y, Random random, Sound Sound) : base(x, y)
        {
            spritemap = new Spritemap <Animation>("Assets/Img/minigun.png", 110, 45);

            spritemap.Add(Animation.Shoot, "0,1,2,3,4,5,6,7,8,9,10,11", 4);
            this.random = random;
            this.Sound  = Sound;
            spritemap.CenterOrigin();
            spritemap.Play(Animation.Shoot);
            AddGraphic(spritemap);
        }
예제 #21
0
파일: Program.cs 프로젝트: oLaudix/IdleGame
        public Hover(float x, float y, Random random, Sound Sound) : base(x, y)
        {
            spritemap = new Spritemap <Animation>("Assets/Img/hover.png", 104, 70);

            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,34,35", 3);
            this.random = random;
            this.Sound  = Sound;
            spritemap.CenterOrigin();
            spritemap.Play(Animation.Shoot);
            AddGraphic(spritemap);
        }
예제 #22
0
 public ToCloserMonsterWeaponTurret(float x = 0, float y = 0) : base(range:300, maxtargets:2)
 {
     X = x;
     Y = y;
     Sprite = new Spritemap<string>(Resources.Sprites.Turrets.TOWER_1_1, 40, 40);
     Graphic = Sprite;
     Graphic.CenterOrigin();
     AddComponents(new ToCloserMonsterWeapon(this));
     AddComponents(new AoEWeapon(this));
     AddComponent(new Rotation(this, 180));
 }
예제 #23
0
파일: Program.cs 프로젝트: oLaudix/IdleGame
 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);
 }
예제 #24
0
파일: Machine.cs 프로젝트: DrMelon/AGDSJam1
 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);
 }
예제 #25
0
파일: Program.cs 프로젝트: oLaudix/IdleGame
        public IronSuit(float x, float y, Random random, Sound Sound) : base(x, y)
        {
            spritemap = new Spritemap <Animation>("Assets/Img/Player.png", 139, 61);

            spritemap.Add(Animation.Shoot, "0,1,2,3", 4);
            this.random = random;
            this.Sound  = Sound;
            spritemap.CenterOrigin();
            spritemap.Play(Animation.Shoot);
            //spritemap.
            AddGraphic(spritemap);
        }
예제 #26
0
        public static Spritemap makeWalker()
        {
            var map = new Spritemap(Library.Get <Texture>(
                                        "content/image/JulepSpice.png"), 20, 38);

            map.OriginX = map.Width / 2;
            map.OriginY = map.Height;

            map.Add("idle", FP.MakeFrames(0, 1), 1, true);
            map.Play("idle");
            return(map);
        }
예제 #27
0
        public SimpleAnimation(float x, float y, int w, int h, int frames, string path, float speed)
            : base(x, y)
        {
            var sprite = new Spritemap(Global.imagePath + "FX/" + path + ".png", w, h);

            sprite.CenterOrigin();
            sprite.Add(0, "0-" + frames, speed);
            AddGraphic(sprite);
            sprite.Anims[0].OnComplete += () => { RemoveSelf(); };
            sprite.Anims[0].NoRepeat();
            sprite.Play(0);

            AddComponent(new YSort());
        }
예제 #28
0
        public BulletExplosion(float x, float y) : base(x, y)
        {
            destroyFrame = DESTROY_FRAME;

            // Set up our explosion animation, and play it. Lastly, set our graphic.
            sprite = new Spritemap <string>(Assets.BULLET_EXPLOSION, 32, 40);
            sprite.Add("Emit", new int[] { 0, 1, 2, 3 }, new float[] { 10f, 10f, 10f, 10f });
            sprite.Play("Emit");
            Graphic = sprite;

            bulletExplodeSnd.Play();

            // Shake the camera each time we explode
            Global.camShaker.ShakeCamera();
        }
예제 #29
0
        //private Sound exSound = new Sound(Assets.SOUND_EFFECTS_EXPLOSION);

        public Effects_Explosion(float x, float y)
            : base(x, y)
        {
            destroyFrame = DESTROY_FRAME;

            sprite = new Spritemap <string>(Assets.SPRITE_EXPLOSION, 64, 64);
            sprite.Add("Emit", new int[] { 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 }, new float[] { 10f, 10f, 10f, 10f, 10f, 10f, 10f, 10f, 10f, 10f, 10f, 10f, 10f, 10f, 10f, 10f, 10f, 10f, 10f, 10f, 10f, 10f, 10f, 10f, 10f });

            sprite.CenterOrigin();
            sprite.Play("Emit");
            Graphic = sprite;

            Global.camShaker.ShakeCamera();
            //exSound.Play();
        }
예제 #30
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");
        }
예제 #31
0
        public Player(float x, float y, uint id) : base(x, y)
        {
            Type            = CollisionType;
            this.id         = id;
            this.controller = new Controller(id);

            cameraFollow         = new CameraFollow();
            cameraFollow.offsetY = -175;
            AddLogic(cameraFollow);

            physics = new PhysicsBody();
            physics.Colliders.Add("platform");
            physics.Colliders.Add("wall");
            physics.maxXVelocity = 8f;
            AddLogic(physics);

            //Add sprites
            bodySprites         = new Spritemap(Library.GetTexture("assets/Timunkslowres.png"), 88, 100, OnAnimationEndBody);
            bodySprites.OriginX = 44;
            bodySprites.OriginY = 100;

            faceSprites = new Spritemap(Library.GetTexture("assets/TimunksFacetestlowres2.png"), 42, 34, OnAnimationEndFace);
            faceSprites.CenterOrigin();
            faceSprites.OriginX = 21;

            //add all the things
            foreach (KeyValuePair <string, AnimationData> entry in BodyAnimDict)
            {
                bodySprites.Add(entry.Key, entry.Value.frames, entry.Value.fps, entry.Value.loop);
            }
            foreach (KeyValuePair <string, AnimationData> entry in FaceAnimDict)
            {
                faceSprites.Add(entry.Key, entry.Value.frames, entry.Value.fps, entry.Value.loop);
            }

            bodySprites.Play("Idle");
            faceSprites.Play("Idle");

            AddGraphic(bodySprites);
            AddGraphic(faceSprites);

            this.SetOrigin(44, 100);
            this.SetHitbox(48, 100, 24, 100);

            //Add a hat
            hat = new NoHat(this);
        }
예제 #32
0
        /// <summary>
        /// Add your own SpriteMap to your GuiButton.  Make sure it contains 4 animations named: "active", "inactive", "clicked", and "hover".
        /// </summary>
        /// <param name="spritemap">The spritemap to use for the button</param>
        public void SetSpriteMap(Spritemap <string> spritemap)
        {
            Dictionary <string, Anim> sprites = spritemap.Anims;

            try
            {
                if (sprites.ContainsKey("inactive") && sprites.ContainsKey("active") && sprites.ContainsKey("clicked") && sprites.ContainsKey("hover"))
                {
                    buttonSpriteMap = spritemap;
                }
            }
            catch
            {
                Console.WriteLine("Incorrect animations set up for SpriteMap! Make sure you have these 4 animation names: active, inactive, hover, clicked");
                throw;
            }
        }
예제 #33
0
        public Orb(float x, float y, OrbType orbType, Entity follow)
            : base(x, y)
        {
            baseOrb = new Spritemap(Library.Get <Texture>(GetTexture(OrbType = orbType)), 24, 24);
            //baseOrb.Color = Engine.Random.Color();
            baseOrb.CenterOrigin();
            baseOrb.RenderStep = -1;
            baseOrb.Add("idle", FP.MakeFrames(0, 0), 3, true);
            baseOrb.Play("idle");

            AddComponent <Image>(baseOrb);

            DistanceToLeader = DISTANCE_BEWTWEEN_ORBS * (int)OrbType;
            //Console.WriteLine(DistanceToLeader);

            followLeader = follow;
        }
예제 #34
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");
        }
예제 #35
0
        public bool CreateHead(string headName, bool isAvatar)
        {
            try
            {
                var       newHeadImage = Library.GetTexture((isAvatar ? "twitchAvatar//" : "twitch//") + headName);
                var       animDataPath = string.Format("{0}{1}.json", Indigo.Content.TwitchEmoteProvider.TWITCH_CACHE_PATH, headName);
                Spritemap tempSp       = null;
                if (!File.Exists(animDataPath))
                {
                    Head = new Image(newHeadImage);
                }
                else
                {
                    var animationData = JsonLoader.Load <FramePacker.PackedSpriteMapMeta>(animDataPath, false);
                    var headSpriteMap = new Spritemap(newHeadImage, animationData.FrameWidth, animationData.FrameHeight);
                    headSpriteMap.Add("Default", FP.MakeFrames(0, animationData.TotalFrames - 1), 24, true);
                    headSpriteMap.Play("Default");                    //animationData.FPS
                    Head   = headSpriteMap;
                    tempSp = headSpriteMap;
                }
                AddComponent(Head);

                Head.CenterOrigin();
                Head.Scale = AnimatedEntityData.Animations[Sprite.CurrentAnim].HeadWidth / (float)Head.Width;

                Head.X = AnimatedEntityData.Animations[Sprite.CurrentAnim].HeadPositionX;
                Head.Y = AnimatedEntityData.Animations[Sprite.CurrentAnim].HeadPositionY;

                currentHeadTween = Tweener.Tween(Head, new { Y = AnimatedEntityData.Animations[Sprite.CurrentAnim].HeadPositionY - 4 }, .7f);
                currentHeadTween.Ease(Ease.ToAndFro);
                currentHeadTween.Repeat();

                currentHeadName = headName;
                return(true);
            }
            catch (Exception ex)
            {
#if DEBUG
                Console.WriteLine("Cannot Find: " + headName);
                Console.WriteLine(ex);
#endif
                //throw (ex);
                return(false);
            }
        }
예제 #36
0
 /// <summary>
 /// Define a spritemap to be used by the button.  Each spritemap should contain either 3, or 4 images.  Each image will be used depending on which
 /// event state its in.  If you do not want your buttons to change their appearance when "active", use a spritemap with only 3 images. The "active" and "inactive" images will be the same.
 /// The images in the spritemap will be used in this index order:
 /// index 0: "inactive" image
 /// index 1: "hover" image
 /// index 2: "clicked" image
 /// index 3: "active" image
 /// </summary>
 /// <param name="path">The path where the graphic file is stored</param>
 public void SetSpriteMap(string path)
 {
     buttonSpriteMap = new Spritemap <string>(path, Width, Height);
     if (buttonSpriteMap.Frames == 4)
     {
         buttonSpriteMap.Add("inactive", new int[] { 0 }, new float[] { 1f });
         buttonSpriteMap.Add("hover", new int[] { 1 }, new float[] { 1f });
         buttonSpriteMap.Add("clicked", new int[] { 2 }, new float[] { 1f });
         buttonSpriteMap.Add("active", new int[] { 3 }, new float[] { 1f });
     }
     else if (buttonSpriteMap.Frames == 3)
     {
         buttonSpriteMap.Add("inactive", new int[] { 0 }, new float[] { 1f });
         buttonSpriteMap.Add("hover", new int[] { 1 }, new float[] { 1f });
         buttonSpriteMap.Add("clicked", new int[] { 2 }, new float[] { 1f });
         buttonSpriteMap.Add("active", new int[] { 0 }, new float[] { 1f });
     }
 }
예제 #37
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;
        }
예제 #38
0
        public override void Load(System.Xml.XmlNode node)
        {
            base.Load(node);
            //Graphic = Image.CreateRect(64, 64, FP.Color(0x66FF33));

            //make the enemy hittable and all that jazz
            Type    = "enemy";
            physics = new PhysicsBody();
            physics.Colliders.Add("wall");
            physics.Colliders.Add("platform");
            physics.Colliders.Add("player");
            AddLogic(physics);

            //hitboxs and such
            spritemap = new Spritemap(Library.GetTexture("assets/RoadHeadlowres.png"), 167 / 2, 257 / 2, onAnimationEnd);
            spritemap.Add("Idle", FP.Frames(0), 5, true);
            spritemap.Add("Move", FP.MakeFrames(0, 2), 5, true);
            spritemap.Add("ChargeAttack", FP.MakeFrames(3, 12), 8, false);
            spritemap.Add("Attack", FP.MakeFrames(13, 22), 8, false);
            spritemap.Add("Recover", FP.MakeFrames(23, 27), 5, false);
            spritemap.Add("Injured", FP.MakeFrames(27, 23), 5, true);
            spritemap.Play("Move");

            spritemap.OriginX = spritemap.Width / 2;
            spritemap.OriginY = spritemap.Height;
            AddGraphic(spritemap);

            SetOrigin(spritemap.Width / 2, 257 / 2);
            SetHitbox(spritemap.Width, spritemap.Height, spritemap.Width / 2, spritemap.Height);

            foreach (System.Xml.XmlNode n in node)
            {
                FP.Log(int.Parse(n.Attributes["x"].Value) + " " + float.Parse(n.Attributes["y"].Value));
                positionNodes.Add(new Vector2i(int.Parse(n.Attributes["x"].Value), int.Parse(n.Attributes["y"].Value)));
            }


            if (positionNodes.Count > 0)
            {
                nextNode = positionNodes[0];
                MoveToNextPos();
            }
        }
예제 #39
0
파일: Player.cs 프로젝트: DrMelon/AGDSJam1
        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;
        }
예제 #40
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();
        }
예제 #41
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;
        }
예제 #42
0
        public Slash(float x, float y, float dirX, float dirY, Damage.Side side)
            : base(x, y)
        {
            sprite = new Spritemap(Global.imagePath + "Player/Slash.png", 64, 64);
            sprite.Add(0, new Anim("0-3", "3"));
            sprite.Angle    = MathHelper.ToDegrees((float)Math.Atan2(dirX, dirY)) + 90;
            sprite.FlippedY = dirX > 0;
            sprite.SetOrigin(0, 32);

            AddGraphic(sprite);
            sprite.Play(0);
            sprite.Anims[0].NoRepeat();
            sprite.Anims[0].OnComplete += () => { RemoveSelf(); };

            AddComponents(damage = new Damage(5, x, y, side));

            var col = new LineCollider(-dirX * 10, -dirY * 10, -dirX * 50, -dirY * 50, Global.Tags.Attack);

            AddCollider(col);
            AddComponent(new YSort());
        }
예제 #43
0
        public Enemy(float x, float y) : base(x, y)
        {
            health = DEFAULT_HEALTH;
            speed  = DEFAULT_SPEED;

            // Set up the Spritemap in the same manner we did for the player
            sprite = new Spritemap <string>(Assets.ENEMY_SPRITE, 32, 40);
            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 });
            sprite.Play("standLeft");

            Graphic = sprite;

            // Set our Enemy hitbox to be 32 x 40. This goes in our Enemy class
            SetHitbox(32, 40, (int)Global.Type.ENEMY);
        }
예제 #44
0
        public Projectile(float x, float y, float dirX, float dirY, Damage.Side side)
            : base(x, y)
        {
            this.dirX = dirX;
            this.dirY = dirY;
            this.side = side;

            sprite = new Spritemap(Global.imagePath + "FX/projectile.png", 32, 32);
            sprite.Add(0, new Anim("0-5", "2"));
            sprite.Play(0);
            sprite.CenterOrigin();
            AddGraphic(sprite);

            AddCollider(new CircleCollider(4, Global.Tags.Attack));
            Collider.CenterOrigin();

            damage = AddComponent(new Damage(5, X, Y, side));

            AddComponent(new YSort());

            LifeSpan = 250;
        }
예제 #45
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();
        }
예제 #46
0
파일: Ship.cs 프로젝트: DrMelon/intrepid
        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);
        }
예제 #47
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);
        }
예제 #48
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);
 }