Esempio n. 1
0
 public void Stop()
 {
     StaticKeyboard.RemoveKeyUpListener(Events.KeyUp);
     StaticKeyboard.RemoveKeyDownListener(Events.KeyDown);
     StaticMouse.RemoveMouseDownListener(Events.MouseClick);
     StaticMouse.RemoveMouseWheelListener(Events.MouseWheel);
 }
Esempio n. 2
0
 public void Stop()
 {
     StaticDisplay.FPSCap = 60;
     StaticDisplay.RemoveResizeListener(Resize);
     StaticMouse.RemoveMouseDownListener(MouseDown);
     StaticKeyboard.RemoveKeyDownListener(KeyDown);
 }
Esempio n. 3
0
 public void Start(GameMode mode)
 {
     bStopRequested = false;
     barrels        = new List <Barrel>();
     StaticKeyboard.AddKeyDownListener(KeyDown);
     tickCount   = 100;
     barrelSpawn = 200;
     gravity     = 0.6F;
     CreateLevel();
 }
Esempio n. 4
0
        public void Stop()
        {
            ChangeScreen(null);
            StaticDisplay.RemoveResizeListener(Resize);

            StaticMouse.RemoveMouseDownListener(MouseDown);
            StaticMouse.RemoveMouseUpListener(MouseUp);
            StaticMouse.RemoveMouseWheelListener(MouseWheel);

            StaticKeyboard.RemoveKeyDownListener(KeyDown);
            StaticKeyboard.RemoveKeyUpListener(KeyUp);
        }
Esempio n. 5
0
        public void Start(GameMode mode)
        {
            StaticDisplay.AddResizeListener(Resize);

            StaticMouse.AddMouseDownListener(MouseDown);
            StaticMouse.AddMouseUpListener(MouseUp);
            StaticMouse.AddMouseWheelListener(MouseWheel);

            StaticKeyboard.AddKeyDownListener(KeyDown);
            StaticKeyboard.AddKeyUpListener(KeyUp);
            ChangeScreen(GuiGameMenu);
        }
Esempio n. 6
0
        public void Start(GameMode mode)
        {
            Round.StartHeight    = StaticDisplay.DisplayHeight;
            Round.StartWidth     = StaticDisplay.DisplayWidth;
            StaticDisplay.FPSCap = 150;
            Textures.LoadTextures();
            Round.LoadLevels();
            Round.CurrentLevel = Round.Levels[0];
            Round.PlayerOne    = new Human();

            StaticDisplay.AddResizeListener(Resize);
            StaticMouse.AddMouseDownListener(MouseDown);
            StaticKeyboard.AddKeyDownListener(KeyDown);
        }
Esempio n. 7
0
 public void Start(GameMode mode)
 {
     if (mode == GameMode.SINGLEPLAYER)
     {
         multiplayer = false;
     }
     else
     {
         multiplayer = true;
     }
     StaticDisplay.AddResizeListener(Resize);
     StaticKeyboard.AddKeyDownListener(KeyDown);
     stopRequested = false;
     Restart();
 }
Esempio n. 8
0
        void IGameInstance.Start(GameMode mode)
        {
            Auto._globalStepFactor = (double)Config.gameTickBase / Config.gameTicksPS;

            Auto.objects = new ObjBox[Config.maxObjs];

            Auto.player1 = new Point(0, 0);
            for (int i = 0; i < Auto.objects.Length; i++)
            {
                Auto.objects[i] = new ObjBox(Config.rand.Next(-500, 500), Config.rand.Next(-500, 500));
            }


            StaticKeyboard.AddKeyUpListener(Events.KeyUp);
            StaticKeyboard.AddKeyDownListener(Events.KeyDown);
            StaticMouse.AddMouseDownListener(Events.MouseClick);
            StaticMouse.AddMouseWheelListener(Events.MouseWheel);
        }
Esempio n. 9
0
        public void Start(GameMode mode)
        {
            Round.StartHeight    = StaticDisplay.DisplayHeight;
            Round.StartWidth     = StaticDisplay.DisplayWidth;
            StaticDisplay.FPSCap = 80;
            Textures.LoadTextures();
            Round.LoadLevels();
            Round.CurrentLevel = Round.Levels[1];
            Round.PlayerOne    = new Human();
            Spider spider  = new Spider(new RectangleF(200, 400, 80, 80));
            Spider spider1 = new Spider(new RectangleF(800, 400, 80, 80));
            Spider spider2 = new Spider(new RectangleF(600, 400, 80, 80));
            Spider spider3 = new Spider(new RectangleF(1000, 400, 80, 80));

            StaticDisplay.AddResizeListener(Resize);
            StaticMouse.AddMouseDownListener(MouseDown);
            StaticKeyboard.AddKeyDownListener(KeyDown);
        }
Esempio n. 10
0
 public void Start(GameMode mode)
 {
     fieldCountX = 13;
     fieldCountY = 11;
     field       = new Rectangle[fieldCountX, fieldCountY];
     if (mode == GameMode.SINGLEPLAYER)
     {
         multiplayer = false;
     }
     else
     {
         multiplayer = true;
     }
     StaticDisplay.AddResizeListener(Resize);
     StaticKeyboard.AddKeyDownListener(KeyDown);
     stopRequested = false;
     Restart();
     //System.Threading.Thread.Sleep(2000);
 }
Esempio n. 11
0
 public void IsKeyDown()
 {
     if (player[0].Direction != new Vector2(0, 0))
     {
         if (StaticKeyboard.IsKeyDown(Keys.W) && player[0].LastDirection.Y != 1)
         {
             player[0].Direction = new Vector2(0, -1);
         }
         if (StaticKeyboard.IsKeyDown(Keys.S) && player[0].LastDirection.Y != -1)
         {
             player[0].Direction = new Vector2(0, 1);
         }
         if (StaticKeyboard.IsKeyDown(Keys.A) && player[0].LastDirection.X != 1)
         {
             player[0].Direction = new Vector2(-1, 0);
         }
         if (StaticKeyboard.IsKeyDown(Keys.D) && player[0].LastDirection.X != -1)
         {
             player[0].Direction = new Vector2(1, 0);
         }
         if (multiplayer)
         {
             if (StaticKeyboard.IsKeyDown(Keys.Up) && player[1].LastDirection.Y != 1)
             {
                 player[1].Direction = new Vector2(0, -1);
             }
             else if (StaticKeyboard.IsKeyDown(Keys.Down) && player[1].LastDirection.Y != -1)
             {
                 player[1].Direction = new Vector2(0, 1);
             }
             else if (StaticKeyboard.IsKeyDown(Keys.Left) && player[1].LastDirection.X != 1)
             {
                 player[1].Direction = new Vector2(-1, 0);
             }
             else if (StaticKeyboard.IsKeyDown(Keys.Right) && player[1].LastDirection.X != -1)
             {
                 player[1].Direction = new Vector2(1, 0);
             }
         }
     }
 }
Esempio n. 12
0
        public override void Update()
        {
            if (Healthpoints <= 0)
            {
                MessageBox.Show("Game Over!: You died");
            }
            else
            {
                if (StaticKeyboard.IsKeyDown(Keys.W) && _currentWalkDir == WalkDirection.None)
                {
                    _currentWalkDir = WalkDirection.Jump;
                }
                if (StaticKeyboard.IsKeyDown(Keys.A))
                {
                    _currentWalkDir  = WalkDirection.Left;
                    _watchDir        = WatchDirection.Left;
                    _DeltaJumpHeight = 0;
                }
                if (StaticKeyboard.IsKeyDown(Keys.D))
                {
                    _currentWalkDir  = WalkDirection.Right;
                    _watchDir        = WatchDirection.Right;
                    _DeltaJumpHeight = 0;
                }

                // Gravity
                if (_hitbox.Y < Hitbox.Y + StaticDisplay.DisplayHeight / 2)
                {
                    _hitbox.Y += Gravity * (float)StaticDisplay.FixedDelta;
                }

                // Animation on Jumping
                if (_currentWalkDir == WalkDirection.Jump)
                {
                    Gravity = 12;
                    if (_DeltaJumpHeight < maxJumpHeight)
                    {
                        _DeltaJumpHeight += 25 * (int)StaticDisplay.FixedDelta;
                        _hitbox.Y        -= 25 * (float)StaticDisplay.FixedDelta;
                    }
                    else if (_hitbox.Bottom >= StaticDisplay.DisplayHeight - 70 || IsCollision())
                    {
                        _DeltaJumpHeight = 0;
                        _currentWalkDir  = WalkDirection.None;
                        return;
                    }
                }

                // Animation when running to the right
                if (_currentWalkDir == WalkDirection.Right)
                {
                    if (_DeltaWalk < maxWalkWidth)
                    {
                        Textures.MobBitmaps.TryGetValue("HumanRightWalk", out Bitmap bitmap);
                        {
                            CurrentTexture = bitmap;
                        }
                        _DeltaWalk += 7 * (int)StaticDisplay.FixedDelta;
                        _hitbox.X  += 7 * (int)StaticDisplay.FixedDelta;
                    }
                    else
                    {
                        Textures.MobBitmaps.TryGetValue("HumanRight", out Bitmap bitmap);
                        {
                            CurrentTexture = bitmap;
                        }
                        _DeltaWalk      = 0;
                        _currentWalkDir = WalkDirection.None;
                    }
                }

                // Animation when running to the left
                if (_currentWalkDir == WalkDirection.Left)
                {
                    if (_DeltaWalk < maxWalkWidth)
                    {
                        Textures.MobBitmaps.TryGetValue("HumanLeftWalk", out Bitmap bitmap);
                        {
                            CurrentTexture = bitmap;
                        }
                        _DeltaWalk += 7 * (int)StaticDisplay.FixedDelta;
                        _hitbox.X  -= 7 * (int)StaticDisplay.FixedDelta;
                    }
                    else
                    {
                        Textures.MobBitmaps.TryGetValue("HumanLeft", out Bitmap bitmap);
                        {
                            CurrentTexture = bitmap;
                        }
                        _DeltaWalk      = 0;
                        _currentWalkDir = WalkDirection.None;
                    }
                }
            }
        }
Esempio n. 13
0
 public void Stop()
 {
     StaticDisplay.RemoveResizeListener(Resize);
     StaticKeyboard.RemoveKeyDownListener(KeyDown);
     stopRequested = false;
 }
Esempio n. 14
0
 public void Stop()
 {
     StaticKeyboard.RemoveKeyDownListener(KeyDown);
 }