示例#1
0
 public Entity(TextureDrawer[] texes_, Vector2 pos_, SoundManager sm_ = null, bool isSolid_ = false)
 {
     sm         = sm_;
     isSolid    = isSolid_;
     pos        = pos_;
     texes      = texes_;
     currentTex = texes[0];
     Yvel       = 0;
     Xvel       = 0;
     onground   = false;
     hp         = 1;
     isDead     = false;
     speed      = 1;
     isOnWall   = false;
 }
示例#2
0
        public Entity GetEntity(int id, Vector2 pos_)
        {
            TextureDrawer        td = new TextureDrawer(src, new Rectangle((id % columns) * tileDims.X, (id / columns) * tileDims.Y, tileDims.X, tileDims.Y), Point.Zero, "imatile");
            List <TextureDrawer> ts = new List <TextureDrawer>();

            ts.Add(td);
            foreach (TextureDrawer t in addTex[id])
            {
                ts.Add(t);
            }
            if (slimeball[id])
            {
                return(new Bouncie(ts.ToArray(), pos_, 100, sm));
            }
            else
            {
                return(null);
            }
        }
示例#3
0
 public Lifebar(TextureDrawer tex_)
 {
     tex = tex_;
 }
示例#4
0
文件: Game1.cs 项目: Fusionnist/LD40
 void SetupEnd()
 {
     endscr = new TextureDrawer(Content.Load <Texture2D>("menu"));
 }
示例#5
0
文件: Game1.cs 项目: Fusionnist/LD40
        protected override void LoadContent()
        {
            soundManager.AddEffect(Content.Load <SoundEffect>("hurty"), "hurty");
            soundManager.AddEffect(Content.Load <SoundEffect>("jumpsf"), "jump");

            soundManager.AddEffect(Content.Load <SoundEffect>("jumpsf2"), "jump2");
            soundManager.AddEffect(Content.Load <SoundEffect>("dashsf"), "dash");
            soundManager.AddEffect(Content.Load <SoundEffect>("thump"), "thump");
            soundManager.AddEffect(Content.Load <SoundEffect>("shhot"), "shoot");
            soundManager.AddEffect(Content.Load <SoundEffect>("coin"), "coin");

            menu = new TextureDrawer(Content.Load <Texture2D>("Menu"));

            spriteBatch = new SpriteBatch(GraphicsDevice);

            emptyheart = new TextureDrawer(Content.Load <Texture2D>("emptyheart"));
            fullheart  = new TextureDrawer(Content.Load <Texture2D>("fullheart2"));

            Texture2D src = Content.Load <Texture2D>("Original");
            Font      f   = new Font(new TextureDrawer[] {
                new TextureDrawer(src, new Rectangle(0, 0, 16, 16), Point.Zero, "a"),
                new TextureDrawer(src, new Rectangle(16, 0, 16, 16), Point.Zero, "b"),
                new TextureDrawer(src, new Rectangle(32, 0, 16, 16), Point.Zero, "c"),
                new TextureDrawer(src, new Rectangle(48, 0, 16, 16), Point.Zero, "d"),
                new TextureDrawer(src, new Rectangle(64, 0, 16, 16), Point.Zero, "e"),
                new TextureDrawer(src, new Rectangle(80, 0, 16, 16), Point.Zero, "f"),
                new TextureDrawer(src, new Rectangle(96, 0, 16, 16), Point.Zero, "g"),
                new TextureDrawer(src, new Rectangle(112, 0, 16, 16), Point.Zero, "h"),
                new TextureDrawer(src, new Rectangle(128, 0, 16, 16), Point.Zero, "i"),
                new TextureDrawer(src, new Rectangle(144, 0, 16, 16), Point.Zero, "j"),
                new TextureDrawer(src, new Rectangle(160, 0, 16, 16), Point.Zero, "k"),
                new TextureDrawer(src, new Rectangle(176, 0, 16, 16), Point.Zero, "l"),
                new TextureDrawer(src, new Rectangle(192, 0, 16, 16), Point.Zero, "m"),
                new TextureDrawer(src, new Rectangle(208, 0, 16, 16), Point.Zero, "n"),
                new TextureDrawer(src, new Rectangle(224, 0, 16, 16), Point.Zero, "o"),
                new TextureDrawer(src, new Rectangle(240, 0, 16, 16), Point.Zero, "p"),
                new TextureDrawer(src, new Rectangle(256, 0, 16, 16), Point.Zero, "q"),
                new TextureDrawer(src, new Rectangle(272, 0, 16, 16), Point.Zero, "r"),
                new TextureDrawer(src, new Rectangle(288, 0, 16, 16), Point.Zero, "s"),
                new TextureDrawer(src, new Rectangle(304, 0, 16, 16), Point.Zero, "t"),

                new TextureDrawer(src, new Rectangle(0, 16, 16, 16), Point.Zero, "u"),
                new TextureDrawer(src, new Rectangle(16, 16, 16, 16), Point.Zero, "v"),
                new TextureDrawer(src, new Rectangle(32, 16, 16, 16), Point.Zero, "w"),
                new TextureDrawer(src, new Rectangle(48, 16, 16, 16), Point.Zero, "x"),
                new TextureDrawer(src, new Rectangle(64, 16, 16, 16), Point.Zero, "y"),
                new TextureDrawer(src, new Rectangle(80, 16, 16, 16), Point.Zero, "z"),

                new TextureDrawer(src, new Rectangle(0, 32, 16, 16), Point.Zero, "1"),
                new TextureDrawer(src, new Rectangle(16, 32, 16, 16), Point.Zero, "2"),
                new TextureDrawer(src, new Rectangle(32, 32, 16, 16), Point.Zero, "3"),
                new TextureDrawer(src, new Rectangle(48, 32, 16, 16), Point.Zero, "4"),
                new TextureDrawer(src, new Rectangle(64, 32, 16, 16), Point.Zero, "5"),
                new TextureDrawer(src, new Rectangle(80, 32, 16, 16), Point.Zero, "6"),
                new TextureDrawer(src, new Rectangle(96, 32, 16, 16), Point.Zero, "7"),
                new TextureDrawer(src, new Rectangle(112, 32, 16, 16), Point.Zero, "8"),
                new TextureDrawer(src, new Rectangle(128, 32, 16, 16), Point.Zero, "9"),
                new TextureDrawer(src, new Rectangle(144, 32, 16, 16), Point.Zero, "0"),

                new TextureDrawer(src, new Rectangle(160, 32, 8, 16), Point.Zero, ","),
                new TextureDrawer(src, new Rectangle(168, 32, 8, 16), Point.Zero, "-"),
                new TextureDrawer(src, new Rectangle(176, 32, 8, 16), Point.Zero, "!"),
                new TextureDrawer(src, new Rectangle(184, 32, 8, 16), Point.Zero, "?"),
                new TextureDrawer(src, new Rectangle(192, 32, 8, 16), Point.Zero, ":"),

                new TextureDrawer(src, new Rectangle(160, 48, 8, 16), Point.Zero, " "),
            },
                                     "font");

            fd.fonts.Add(f);
        }
示例#6
0
文件: Game1.cs 项目: Fusionnist/LD40
        void GoToNewGame()
        {
            wealth = 0;
            pars   = new Particles(getTDXML("particle"));
            gp     = GamePhase.Game;
            maps   = new List <Tilemap>();
            //0
            maps.Add(getTilemap(XDocument.Load("Content/00.tmx"), new Point(-1, 0)));
            maps.Add(getTilemap(XDocument.Load("Content/00.tmx"), Point.Zero));
            //1
            maps.Add(getTilemap(XDocument.Load("Content/10.tmx"), new Point(1, 0)));
            maps.Add(getTilemap(XDocument.Load("Content/11.tmx"), new Point(1, -1)));
            //2
            maps.Add(getTilemap(XDocument.Load("Content/20.tmx"), new Point(2, 0)));
            maps.Add(getTilemap(XDocument.Load("Content/21.tmx"), new Point(2, -1)));
            maps.Add(getTilemap(XDocument.Load("Content/22.tmx"), new Point(2, -2)));
            maps.Add(getTilemap(XDocument.Load("Content/23.tmx"), new Point(2, -3)));
            maps.Add(getTilemap(XDocument.Load("Content/24.tmx"), new Point(2, -4)));
            maps.Add(getTilemap(XDocument.Load("Content/25.tmx"), new Point(2, -5)));
            //3
            maps.Add(getTilemap(XDocument.Load("Content/30.tmx"), new Point(3, 0)));
            maps.Add(getTilemap(XDocument.Load("Content/31.tmx"), new Point(3, -1)));
            maps.Add(getTilemap(XDocument.Load("Content/32.tmx"), new Point(3, -2)));
            maps.Add(getTilemap(XDocument.Load("Content/33.tmx"), new Point(3, -3)));
            maps.Add(getTilemap(XDocument.Load("Content/34.tmx"), new Point(3, -4)));
            //4
            maps.Add(getTilemap(XDocument.Load("Content/40.tmx"), new Point(4, 0)));
            maps.Add(getTilemap(XDocument.Load("Content/41.tmx"), new Point(4, -1)));
            maps.Add(getTilemap(XDocument.Load("Content/42.tmx"), new Point(4, -2)));
            maps.Add(getTilemap(XDocument.Load("Content/43.tmx"), new Point(4, -3)));
            //5
            maps.Add(getTilemap(XDocument.Load("Content/50.tmx"), new Point(5, 0)));
            maps.Add(getTilemap(XDocument.Load("Content/51.tmx"), new Point(5, -1)));
            maps.Add(getTilemap(XDocument.Load("Content/52.tmx"), new Point(5, -2)));
            maps.Add(getTilemap(XDocument.Load("Content/53.tmx"), new Point(5, -3)));
            //6
            maps.Add(getTilemap(XDocument.Load("Content/60.tmx"), new Point(6, 0)));
            maps.Add(getTilemap(XDocument.Load("Content/62.tmx"), new Point(6, -2)));
            maps.Add(getTilemap(XDocument.Load("Content/63.tmx"), new Point(6, -3)));
            //7
            maps.Add(getTilemap(XDocument.Load("Content/70.tmx"), new Point(7, 0)));
            maps.Add(getTilemap(XDocument.Load("Content/73.tmx"), new Point(7, -3)));
            maps.Add(getTilemap(XDocument.Load("Content/7m1.tmx"), new Point(7, 1)));
            //8
            maps.Add(getTilemap(XDocument.Load("Content/80.tmx"), new Point(8, -0)));
            maps.Add(getTilemap(XDocument.Load("Content/82.tmx"), new Point(8, -2)));
            maps.Add(getTilemap(XDocument.Load("Content/83.tmx"), new Point(8, -3)));
            maps.Add(getTilemap(XDocument.Load("Content/84.tmx"), new Point(8, -4)));
            //9
            maps.Add(getTilemap(XDocument.Load("Content/93.tmx"), new Point(9, -3)));

            map = maps[0];

            TextureDrawer walk = new TextureDrawer(Content.Load <Texture2D>("walk"),
                                                   new Rectangle[] {
                new Rectangle(0, 0, 32, 32),
                new Rectangle(32, 0, 32, 32),
                new Rectangle(64, 0, 32, 32),
                new Rectangle(96, 0, 32, 32),
            },
                                                   new Point[] { new Point(16, 16), new Point(16, 16), new Point(16, 16), new Point(16, 16), },
                                                   0.1f, 4, true, "walk");
            TextureDrawer slip = new TextureDrawer(Content.Load <Texture2D>("slip"),
                                                   new Rectangle[] {
                new Rectangle(0, 0, 32, 32),
                new Rectangle(32, 0, 32, 32),
                new Rectangle(64, 0, 32, 32),
                new Rectangle(96, 0, 32, 32),
            },
                                                   new Point[] { new Point(16, 16), new Point(16, 16), new Point(16, 16), new Point(16, 16), },
                                                   0.1f, 4, true, "slip");
            TextureDrawer jump = new TextureDrawer(Content.Load <Texture2D>("jump"),
                                                   new Rectangle(0, 0, 32, 32),
                                                   new Point(16, 16),
                                                   "jump");
            TextureDrawer fall = new TextureDrawer(Content.Load <Texture2D>("jump"),
                                                   new Rectangle(32, 0, 32, 32),
                                                   new Point(16, 16),
                                                   "fall");
            TextureDrawer dash = new TextureDrawer(Content.Load <Texture2D>("dash"),
                                                   new Rectangle(32, 0, 32, 32),
                                                   new Point(16, 16),
                                                   "dash");
            TextureDrawer wallclimb = new TextureDrawer(Content.Load <Texture2D>("walljump"),
                                                        new Rectangle[] {
                new Rectangle(0, 0, 32, 32),
                new Rectangle(32, 0, 32, 32),
                new Rectangle(64, 0, 32, 32),
                new Rectangle(96, 0, 32, 32),
            },
                                                        new Point[] { new Point(16, 16), new Point(16, 16), new Point(16, 16), new Point(16, 16), },
                                                        0.3f, 4, true, "wallclimb");
            TextureDrawer ground      = new TextureDrawer(Content.Load <Texture2D>("ground"), new Rectangle(0, 0, 32, 32), new Point(16, 16), "ground");
            TextureDrawer bag1        = new TextureDrawer(Content.Load <Texture2D>("bag1"), new Rectangle(0, 0, 32, 32), new Point(32, 8), "bag1");
            TextureDrawer bag2        = new TextureDrawer(Content.Load <Texture2D>("bag2"), new Rectangle(0, 0, 32, 32), new Point(32, 10), "bag2");
            TextureDrawer bag3        = new TextureDrawer(Content.Load <Texture2D>("bag3"), new Rectangle(0, 0, 32, 32), new Point(31, 12), "bag3");
            TextureDrawer bag4        = new TextureDrawer(Content.Load <Texture2D>("bag4"), new Rectangle(0, 0, 32, 32), new Point(30, 15), "bag4");
            TextureDrawer ladderstill = new TextureDrawer(Content.Load <Texture2D>("climb"), new Rectangle(0, 0, 32, 32), new Point(16, 16), "ladderstill");
            TextureDrawer dead        = new TextureDrawer(Content.Load <Texture2D>("walk"),
                                                          new Rectangle[] {
                new Rectangle(0, 0, 32, 32),
                new Rectangle(32, 0, 32, 32),
                new Rectangle(64, 0, 32, 32),
                new Rectangle(96, 0, 32, 32),
            },
                                                          new Point[] { new Point(16, 16), new Point(16, 16), new Point(16, 16), new Point(16, 16), },
                                                          0.3f, 4, true, "dead");
            TextureDrawer ladder = new TextureDrawer(Content.Load <Texture2D>("climb"),
                                                     new Rectangle[] {
                new Rectangle(0, 0, 32, 32),
                new Rectangle(32, 0, 32, 32),
                new Rectangle(64, 0, 32, 32),
                new Rectangle(96, 0, 32, 32),
            },
                                                     new Point[] { new Point(16, 16), new Point(16, 16), new Point(16, 16), new Point(16, 16), },
                                                     0.1f, 4, true, "ladder");

            player = new Player(new TextureDrawer[] { walk, dead, wallclimb, ground, jump, fall, dash, slip, ladder, bag1, bag2, bag3, bag4, ladderstill }, new Vector2(100, 150), soundManager);
            mapPos = map.vpos;
        }