Пример #1
0
        public override void Update(GameTime t)
        {
            if (moving)
            {
                var p = Robot.Adjacent(Center, Dir);

                if (game.GameScreen.stage.PassableLayer[p.X, p.Y])
                {
                    pos += vel;
                }
                else
                {
                    moving   = false;
                    stopping = true;
                }
            }
            else if (stopping)
            {
                stopDist += Math.Abs(vel.X) + Math.Abs(vel.Y);
                if (stopDist > Stage.TileSize / 2)
                {
                    vel      = Vector2.Zero;
                    pos      = Stage.TileToPos(Stage.PosToTile(Center));
                    stopping = false;
                    moving   = false;
                    game.GameScreen.stage.PassableLayer[Stage.PosToTile(Center).X, Stage.PosToTile(Center).Y] = false;
                }
                else
                {
                    pos += vel;
                }
            }
        }
Пример #2
0
        public Robot(ADHDGame g, Stage st)
        {
            //init anims
            right     = new Animation(new Rectangle(0, 206, Size.X, Size.Y), 9, rate, true);
            up        = new Animation(new Rectangle(0, 103, Size.X, Size.Y), 9, rate, true);
            down      = new Animation(new Rectangle(0, 0, Size.X, Size.Y), 9, rate, true);
            banjo     = new Animation(new Rectangle(0, 618, Size.X, Size.Y), 9, 1.0f / 10.0f, false);
            banjoPlay = new Animation(new Rectangle(0, 721, Size.X, Size.Y), 9, 1.0f / 10.0f, true);
            die       = new Animation(new Rectangle(0, 824, Size.X, Size.Y), 9, 1.0f / 10.0f, false);
            pushDown  = new Animation(new Rectangle(0, 309, Size.X, Size.Y), 9, 1.0f / 20.0f, false);
            pushUp    = new Animation(new Rectangle(0, 412, Size.X, Size.Y), 9, 1.0f / 20.0f, false);
            pushRight = new Animation(new Rectangle(0, 515, Size.X, Size.Y), 9, 1.0f / 20.0f, false);

            tex      = g.Content.Load <Texture2D>("robot");
            batch    = st.batch;
            stage    = st;
            position = Stage.TileToPos(new Point(11, 17));
            currAnim = down;
            currAnim.Stop();
            Dir      = Direction.Down;
            velocity = Vector2.Zero;
            flip     = SpriteEffects.None;
            game     = g;
            SnapToTile();
        }
Пример #3
0
        private void InitObjects()
        {
            var objs = new ADHDObject[] {
                new HoverDolly(game, batch, objTex, Stage.TileToPos(new Point(9, 9))),
                new HoverDolly(game, batch, objTex, Stage.TileToPos(new Point(14, 10))),
                new HoverDolly(game, batch, objTex, Stage.TileToPos(new Point(15, 15))),
                new HoverDolly(game, batch, objTex, Stage.TileToPos(new Point(8, 22))),
                new HoverDolly(game, batch, objTex, Stage.TileToPos(new Point(14, 21))),
                new HoverDolly(game, batch, objTex, Stage.TileToPos(new Point(17, 21))),
                new HoverDolly(game, batch, objTex, Stage.TileToPos(new Point(17, 27))),
                new HoverDolly(game, batch, objTex, Stage.TileToPos(new Point(7, 21))),
                new HoverDolly(game, batch, objTex, Stage.TileToPos(new Point(7, 15))),
                new HoverDolly(game, batch, objTex, Stage.TileToPos(new Point(17, 27))),
                new Button(game, batch, objTex, Stage.TileToPos(new Point(10, 6)), EndScreen.Ending.Thrusters, 0.4f),
                new Button(game, batch, objTex, Stage.TileToPos(new Point(12, 6)), EndScreen.Ending.Reverse, 0.4f),
                new Button(game, batch, objTex, Stage.TileToPos(new Point(9, 27)), EndScreen.Ending.Dubstep, 2.0f),
                new Button(game, batch, objTex, Stage.TileToPos(new Point(18, 26)), EndScreen.Ending.Bathroom, 1.0f),
                new Airlock(game, batch, objTex, Stage.TileToPos(new Point(9, 13)))
            };

            objects = new List <ADHDObject>(objs);
        }