예제 #1
0
        static void Main(string[] args)
        {
            Dispaly = new Display(1920, 1080);

            TestWorld = new Scene();

            GameObject Ground = TestWorld.AddGameObject(0, 1000, 0);

            // Load Scene Image Data
            RenderData  SceneImageData = new RenderData();
            RenderState GroundImage    = SceneImageData.LoadFile("Ground.png");

            // Load Player Image Data
            PlayerImageData = new RenderData();
            PlayerImage1    = PlayerImageData.LoadFile("Test.bmp");
            PlayerImage2    = PlayerImageData.LoadFile("StateTest.png");

            // Load Projectile Image Data
            ProjectileImageData = new RenderData();
            ProjectileImageData.LoadFile("Projectile.png");

            // Create PhysicsConstraints
            PlayerPhysics     = new PhysicsConstraints(TestWorld);
            StaticPhysics     = new PhysicsConstraints(TestWorld);
            ProjectilePhysics = new PhysicsConstraints(TestWorld);

            PlayerPhysics.Collider         = true;
            StaticPhysics.Static           = true;
            ProjectilePhysics.Collider     = true;
            ProjectilePhysics.OnCollision += OnProjectileCollision;


            Player1       = new Player(TestWorld);
            Player1_Child = TestWorld.AddGameObject(100, 100, 0);
            Player1_Child.Use(PlayerImageData);
            Player1_Child.Use(Player1.Transform);

            Ground.Use(SceneImageData);
            Ground.Use(StaticPhysics);


            KeyListener.AddKeyBind(Key.Up, () => { Camera.Yvel += -CameraSpeed; }, () => { Camera.Yvel -= -CameraSpeed; });
            KeyListener.AddKeyBind(Key.Left, () => { Camera.Xvel += -CameraSpeed; }, () => { Camera.Xvel -= -CameraSpeed; });
            KeyListener.AddKeyBind(Key.Down, () => { Camera.Yvel += CameraSpeed; }, () => { Camera.Yvel -= CameraSpeed; });
            KeyListener.AddKeyBind(Key.Right, () => { Camera.Xvel += CameraSpeed; }, () => { Camera.Xvel -= CameraSpeed; });

            Debugger.EnableDebugger = true;
            Dispaly.Start();
        }
예제 #2
0
 public static void OnProjectileCollision(PhysicsConstraints caller, GameObject parent, GameObject collider)
 {
     collider.Transform.X += 10.0F;
     parent.Dispose();
 }