Пример #1
0
        public ScrapBadger(ScrapGame game, Vector2 pos)
            : base(game)
        {
            torsoBack = new Crate(game, pos + new Vector2(-1,0));
            torsoMiddle = new Crate(game, pos);
            torsoFront = new Crate(game, pos + new Vector2(1, 0));
            backWheel = new Wheel(game, pos + new Vector2(-1, 1));
            frontWheel = new Wheel(game, pos + new Vector2(1, 1));
            rocket1 = new Rocket(game, pos + new Vector2(0, -1));

            KeyObject = torsoMiddle;
            JoinEntities(torsoMiddle, torsoFront, Direction.Right);
            JoinEntities(torsoMiddle, rocket1, Direction.Up);
            JoinEntities(torsoMiddle, torsoBack, Direction.Left);

            JoinEntities(torsoBack, backWheel, Direction.Down);
            //backWheel.body.UserData = this;
            //frontWheel.body.UserData = this;
            JoinEntities(torsoFront, frontWheel, Direction.Down);

            game.camera.Follow(torsoMiddle, game.camera.Magnification);
        }
Пример #2
0
        public ScrapBadger(ScrapGame game, Vector2 pos) : base(game)
        {
            torsoBack   = new Crate(game, pos + new Vector2(-1, 0));
            torsoMiddle = new Crate(game, pos);
            torsoFront  = new Crate(game, pos + new Vector2(1, 0));
            backWheel   = new Wheel(game, pos + new Vector2(-1, 1));
            frontWheel  = new Wheel(game, pos + new Vector2(1, 1));
            rocket1     = new Rocket(game, pos + new Vector2(0, -1));

            KeyObject = torsoMiddle;
            JoinEntities(torsoMiddle, torsoFront, Direction.Right);
            JoinEntities(torsoMiddle, rocket1, Direction.Up);
            JoinEntities(torsoMiddle, torsoBack, Direction.Left);

            JoinEntities(torsoBack, backWheel, Direction.Down);
            //backWheel.body.UserData = this;
            //frontWheel.body.UserData = this;
            JoinEntities(torsoFront, frontWheel, Direction.Down);


            game.camera.Follow(torsoMiddle, game.camera.Magnification);
        }
Пример #3
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);
            background = Content.Load<Texture2D>("sky");
            foreground = Content.Load<Texture2D>("nearback");
            world = new World(new Vector2(0, 1f));

            debugView = new DebugViewXNA(world);
            camera = new Camera(this);
            camera.Position = new Vector2(22,20);
            debugView.LoadContent(GraphicsDevice, Content);

            playerController.LoadContent();
            badger = new ScrapBadger(this, new Vector2(23, 4));

            badger.Rotate(20f * 0.0174532925f);

            crate = new Crate(this, new Vector2(26, 2));
            //XmlLoader loader = new XmlLoader();
            //loader.LoadLevel(ref entityList);

            terrain.LoadContent();
            terrain.CreateGround(world);

            //Init();
        }