Exemplo n.º 1
0
        private DemoScene()
        {
            // set up camera
            Camera = new Camera
            {
                //Zoom = 2,
                Origin   = new Vector2(320, 180),
                Position = new Vector2(200, 400)
            };

            map    = new DemoMap();
            player = new Player(Camera);
            TestEnemy enemy = new TestEnemy(new Vector2(200, 600), player);

            enemy2 = new WalkingEnemy(new Vector2(295, 365), player);
            //enemy2 = new WalkingEnemy(new Vector2(250, 400), player);
            Item item = new Item(player, new Vector2(100, 500));

            children.Add(map);
            children.Add(player);
            //children.Add(enemy);
            children.Add(enemy2);
            children.Add(item);

            physical = new PhysicsGroup(PhysicsGroupType.Physical);
            physical.Add(map);
            physical.Add(player);
            //physical.Add(enemy);
            physical.Add(enemy2);

            writer = new FragmentWriter("Fonts/TooMuchInk", new Rectangle(100, 450, 200, 200), Color.White);
            writer.SetText(Fragment.Parse(example));
        }
Exemplo n.º 2
0
        public void TriArrayErrorCase()
        {
            PhysicsGroup physicsGroup = new PhysicsGroup(PhysicsGroupType.Physical);

            DemoMap demoMap = new DemoMap();
            Player  player  = new Player(new RBGNature.Camera());

            player.collision = new Circle()
            {
                Radius   = 10,
                Mass     = 1,
                Position = new Vector2(170.716476f, 303.425659f),
                Velocity = new Vector2(-0.17978698f, 0.0744702f)
            };

            physicsGroup.Add(demoMap);
            physicsGroup.Add(player);

            physicsGroup.Collide(16.6488f);

            player.Update(new GameTime());

            Assert.IsTrue(player.collision.Position.X + player.collision.Position.Y > 460 + Math.Sqrt(2) * 10);
        }