public override void Update()
 {
     if (Engine.GetKey(Keys.ESCAPE))
     {
         Program.ActualScreenState = Program.ScreenFlow.mainMenuScreen;
     }
 }
 public void Update()
 {
     if (Engine.GetKey(Keys.ESCAPE))
     {
         Program.ActualScreenState = Program.ScreenFlow.level1Screen;
     }
 }
Example #3
0
        public List <bool> CheckInputs()
        {
            if (Engine.GetKey(Keys.LEFT))
            {
                inputs[0] = true;
            }
            else
            {
                inputs[0] = false;
            }

            if (Engine.GetKey(Keys.RIGHT))
            {
                inputs[1] = true;
            }
            else
            {
                inputs[1] = false;
            }



            //pasar de nivel
            if (Engine.GetKey(Keys.P))
            {
                inputs[2] = true;
            }
            else
            {
                inputs[2] = false;
            }

            return(inputs);
        }
Example #4
0
 public void Update()
 {
     if (Engine.GetKey(Keys.ESCAPE))
     {
         GameManager.Instance.ChangeGameState(GameState.MainMenu);
     }
 }
Example #5
0
        public override void Update()
        {
            if (!LifeController.Destroyed)
            {
                //timer += Time.DeltaTime;
                //Console.WriteLine("Respawn in" + timer);

                ScreenLimits();
                Move();

                timerShoot += Time.DeltaTime;
                //Console.WriteLine("Shoot Timer" + timerShoot);

                if (Engine.GetKey(Keys.SPACE) && timerShoot >= timetoShoot)
                {
                    canShoot = true;
                    Shoot();
                    timerShoot = 0;
                }

                collisionTimer += Time.DeltaTime;
                //Console.WriteLine($"Collisiontimer {collisionTimer}");
                //if (/*canReceiveDamage && */collisionTimer >= collisionMaxTimer)
                CheckForCollisionsWEnemy();

                //Console.WriteLine("Can Respawn: " + canRespawn);
            }
        }
Example #6
0
 //private const float IDLE_ANIMATION_PATH = "Png/Player/Idle/;
 public void InputDetection()
 {
     isMoveRightKeyPressed = Engine.GetKey(Keys.D);
     isMoveLeftKeyPressed  = Engine.GetKey(Keys.A);
     isShootingKeyPressed  = Engine.GetKey(Keys.SPACE);
     isMoveDownKeyPressed  = Engine.GetKey(Keys.S);
     isMoveUpKeyPressed    = Engine.GetKey(Keys.W);
 }
Example #7
0
        public void Update()
        {
            currentButton = currentButton.Update();
            arrow.Update(currentButton.PosX, currentButton.PosY);

            if (Engine.GetKey(Keys.SPACE))
            {
                EnterButton();
            }
        }
Example #8
0
 public override void Update()
 {
     actualBtn = actualBtn.Update();
     if (Engine.GetKey(Keys.SPACE) && Program.canPressSpace)
     {
         Program.canPressSpace = false;
         Program.timerSpace    = 0f;
         EnterButton();//MMenuS
         arrow.Update();
     }
 }
Example #9
0
        public void Update()
        {
            buttonActual = buttonActual.Update();
            select.Update(buttonActual.PosX, buttonActual.PosY);

            EnterDelay();

            if (Engine.GetKey(Keys.RETURN) && canEnter)
            {
                canEnter   = false;
                timerEnter = 0f;
                EnterButton();
            }
        }
Example #10
0
        public void Actualizar()
        {
            esperaDeInput += Program.deltaTime;


            botonActual = botonActual.Actualizar();

            flecha.Actualizar(botonActual.posX, botonActual.posY);

            if (Engine.GetKey(Keys.RETURN))
            {
                EnterButon();
            }

            esperaDeInput = 0;
        }
Example #11
0
        public void Update()
        {
            if (Engine.GetKey(Keys.F1))
            {
                ChangeGameState(GameState.WinScreen);
            }

            if (Engine.GetKey(Keys.F2))
            {
                ChangeGameState(GameState.GameOverScreen);
            }


            switch (CurrentState) //casos posibles de var
            {
            case GameState.MainMenu:
                EnemyListIsEmpty();
                MainMenu.Update();
                break;

            case GameState.Credits:
                Credits.Update();
                break;

            case GameState.Options:

                break;

            case GameState.GameOverScreen:
                GameOverScreen.Update();

                break;

            case GameState.WinScreen:
                WinScreen.Update();

                break;

            case GameState.Level:
                LevelController.Update();
                WinCondition();
                break;

            default:
                break;
            }
        }
Example #12
0
        public Button Update()
        {
            _timer += Program.deltaTime;

            if (Engine.GetKey(Keys.UP) && _timer >= _pressTimer)
            {
                _timer = 0f;
                return(_buttonUp);
            }
            else if (Engine.GetKey(Keys.DOWN) && _timer >= _pressTimer)
            {
                _timer = 0f;
                return(_buttonDown);
            }
            else
            {
                return(this);
            }
        }
Example #13
0
        public Boton Actualizar()
        {
            timer += Program.deltaTime;

            if (Engine.GetKey(Keys.W) && timer >= tiempoParaApretar)
            {
                timer = 0f;
                return(GetUp());
            }
            else if (Engine.GetKey(Keys.S) && timer >= tiempoParaApretar)
            {
                timer = 0f;
                return(GetDown());
            }
            else
            {
                return(this);
            }
        }
        public void Update()
        {
            currentInputDelayTime -= Program.deltaTime;
            foreach (var button in buttons)
            {
                button.Update();
            }

            if (Engine.GetKey(Keys.UP) && currentInputDelayTime <= 0)
            {
                ChangeButton(currentButton.PreviousButton);
            }
            if (Engine.GetKey(Keys.DOWN) && currentInputDelayTime <= 0)
            {
                ChangeButton(currentButton.NextButton);
            }
            if (Engine.GetKey(Keys.SPACE) && currentInputDelayTime <= 0)
            {
                SelectButton(currentButton);
            }
        }
Example #15
0
        static void Main(string[] args)
        {
            Engine.Initialize("A ver q onda");
            //Cuando comienza el juego, empieza en el menu principal. Luego entra en el GameLoop
            NivelesManager.AccederMenu();
            pj = new Personaje(100F, 500F);

            while (true)
            {
                Engine.Clear();
                NivelesManager.EjecutarNivelActual();
                if (Jugando)
                {
                    if (Engine.GetKey(Keys.Q))
                    {
                        MenuManager.GuardarPartida();
                    }
                }
                Engine.Show();
            }
        }
Example #16
0
        public override void Move()
        {
            if (Engine.GetKey(Keys.W))
            {
                Transform.Position -= new Vector2(0, Speed.Y * Time.DeltaTime);
            }

            if (Engine.GetKey(Keys.S))
            {
                Transform.Position += new Vector2(0, Speed.Y * Time.DeltaTime);
            }

            if (Engine.GetKey(Keys.A))
            {
                Transform.Position -= new Vector2(Speed.X * Time.DeltaTime, 0);
            }

            if (Engine.GetKey(Keys.D))
            {
                Transform.Position += new Vector2(Speed.X * Time.DeltaTime, 0);
            }
        }
Example #17
0
        public override void Update()
        {
            if (!LifeController.Destroyed)
            {
                //timer += Time.DeltaTime;

                ScreenLimits();
                Move();

                timerShoot += Time.DeltaTime;

                if (Engine.GetKey(Keys.SPACE) && timerShoot >= timetoShoot)
                {
                    Shoot();
                    timerShoot = 0;
                }

                if (LifeController.Damaged)
                {
                    Respawn();
                }
            }
        }
Example #18
0
        public void Actualizar()
        {
            iSentido = -1;

            if (Engine.GetKey(Keys.D))
            {
                x += velocidad * Program.deltaTime;

                estadoActual = Estado.CorrerDer;
                animCorrerDer.Play();

                if (x >= wGame - ((wTex * escala) / 2))
                {
                    x = wGame - (wTex * escala) / 2;
                }

                xGlobal -= velocidad * Program.deltaTime;
                if (xGlobal <= despX)
                {
                    xGlobal = despX;
                }

                int fila    = (int)((y + (-yGlobal)) / tilemap.tamañoTile);
                int columna = (int)((GetXMax() + (-xGlobal)) / tilemap.tamañoTile);
                if (columna > 14)
                {
                    columna = 14;
                }
                if (columna < 0)
                {
                    columna = 0;
                }
                if (fila > 8)
                {
                    fila = 8;
                }
                if (fila < 0)
                {
                    fila = 0;
                }
                int numeroTile = tilemap.tiles[fila, columna];

                if (numeroTile == 2 || numeroTile == 3)
                {
                    if (Program.estadoActual == Program.estado.nivel1)
                    {
                        Program.nivel2.ResetearNivel2();
                        Program.estadoActual = Program.estado.nivel2;
                    }
                    else if (Program.estadoActual == Program.estado.nivel2)
                    {
                        Engine.Debug("GANASTE");

                        Program.estadoActual = Program.estado.win;
                    }
                }
                else if (numeroTile != -1)
                {
                    x       -= velocidad * Program.deltaTime;
                    xGlobal += velocidad * Program.deltaTime;
                }
            }
            else if (Engine.GetKey(Keys.A))
            {
                x -= velocidad * Program.deltaTime;

                estadoActual = Estado.CorrerIzq;
                animCorrerIzq.Play();


                if (x <= ((wTex * escala) / 2))
                {
                    x = (wTex * escala) / 2;
                }

                xGlobal += velocidad * Program.deltaTime;
                if (xGlobal >= 0)
                {
                    xGlobal = 0;
                }

                int fila    = (int)((y + (-yGlobal)) / tilemap.tamañoTile);
                int columna = (int)((GetXMin() + (-xGlobal)) / tilemap.tamañoTile);
                if (columna > 14)
                {
                    columna = 14;
                }
                if (columna < 0)
                {
                    columna = 0;
                }
                if (fila > 8)
                {
                    fila = 8;
                }
                if (fila < 0)
                {
                    fila = 0;
                }
                int numeroTile = tilemap.tiles[fila, columna];

                if (numeroTile == 2 || numeroTile == 3)
                {
                    if (Program.estadoActual == Program.estado.nivel1)
                    {
                        Program.nivel2.ResetearNivel2();
                        Program.nivel2.ResetearVida();
                        Program.estadoActual = Program.estado.nivel2;
                    }
                    else if (Program.estadoActual == Program.estado.nivel2)
                    {
                        Engine.Debug("GANASTE");
                        Program.estadoActual = Program.estado.win;
                    }
                }
                else if (numeroTile != -1)
                {
                    x       += velocidad * Program.deltaTime;
                    xGlobal -= velocidad * Program.deltaTime;
                }
            }
            else
            {
                if (estadoActual == Estado.CorrerDer)
                {
                    estadoActual = Estado.IdleDer;
                    animIdleDer.Play();
                }
                else if (estadoActual == Estado.CorrerIzq)
                {
                    estadoActual = Estado.IdleIzq;
                    animIdleIzq.Play();
                }
            }
        }