Пример #1
0
 public void Render()
 {
     Engine.Debug("TotalCoins:" + Coin.coin);
     Engine.Draw(backgroundTexture);
     Engine.Draw(escapeTexture, 50, 700, 0.5f, 0.5f);
     Engine.Draw(gameOverTexture, 150, 250);
 }
Пример #2
0
        public Node SearchNode(int value, Node node)
        {
            if (node != null)
            {
                if (value == node.value)
                {
                    Engine.Debug("Se encontro el valor");
                }
                else if (value < node.value)
                {
                    node.SearchNode(value, node.lesserNode);
                }
                else if (value > node.value)
                {
                    node.SearchNode(value, node.greaterNode);
                }
            }
            else
            {
                Engine.Debug("No se encontro el valor");
                return(null);
            }

            return(node);
        }
Пример #3
0
        public void Actualizar()
        {
            enemigo1.Actualizar();
            enemigo.Actualizar();
            jugador.Actualizar();

            bool colision  = jugador.ChequearColisiones(enemigo);
            bool colision1 = jugador.ChequearColisiones(enemigo1);


            if (colision || colision1)
            {
                if (VidaManager.Instance.Vida <= 0)
                {
                    Engine.Debug("GAME OVER");
                    Program.estadoActual      = Program.estado.gameover;
                    VidaManager.Instance.Vida = 3;
                }
                else
                {
                    ResetearNivel2();
                    Engine.Debug(VidaManager.Instance.Vida);
                }
            }
        }
Пример #4
0
        public void SaveCsv()
        {
            var csv = GetCsv();

            File.WriteAllText(path, csv);
            Engine.Debug("Save Csv ");
        }
Пример #5
0
        private void CargarAnimaciones()
        {
            List <Texture> correrDer = new List <Texture>();

            for (int i = 1; i <= 14; i++)
            {
                correrDer.Add(Engine.GetTexture("Texturas/Derecha/" + i.ToString() + ".png"));
                Engine.Debug("Texturas / Derecha / " + i.ToString() + ".png" + "  Tengo: " + correrDer.Count);
            }

            List <Texture> correrIzq = new List <Texture>();

            for (int i = 1; i <= 14; i++)
            {
                correrIzq.Add(Engine.GetTexture("Texturas/Izquierda/" + i.ToString() + ".png"));
                Engine.Debug("Texturas / Derecha / " + i.ToString() + ".png" + "  Tengo: " + correrDer.Count);
            }

            List <Texture> idleDer = new List <Texture>();

            idleDer.Add(Engine.GetTexture("Texturas/Idle.png"));

            List <Texture> idleIzq = new List <Texture>();

            idleIzq.Add(Engine.GetTexture("Texturas/IdleIzq.png"));

            animCorrerDer = new Animacion(correrDer, false);
            animCorrerIzq = new Animacion(correrIzq, false);
            animIdleDer   = new Animacion(idleDer, false);
            animIdleIzq   = new Animacion(idleIzq, false);
        }
Пример #6
0
        private static List <Tile> LoadTileset(int tilesetSize, string initialPath)
        {
            List <Tile> tilesaux = new List <Tile>();

            for (int i = 0; i <= tilesetSize; i++)
            {
                string path = initialPath + i.ToString() + ".png";
                tilesaux.Add(new Tile(path, new Vector2D(0, 0), i));
                Engine.Debug("Load texture: " + path);
            }

            return(tilesaux);
        }
Пример #7
0
        public Bullet(Vector2 initialPosition, float angle, float scale, float speed, int damage)
        {
            Position = initialPosition;

            this.angle    = angle;
            this.scale    = scale;
            initialSpeed  = speed;
            initialDamage = damage;

            Engine.Debug("se creo una nueva bala");
            CreateAnimations();
            ResetValues();
        }
Пример #8
0
        private void UpdateCollisions()
        {
            List <Collider> colliderEnemies = new List <Collider>();

            for (int i = 0; i < Enemies.Count; i++)//Lista enemigos del nivel
            {
                colliderEnemies.Add(Enemies[i].EnemyCollider);
            }

            if (GameManager.Instance.Player1.Collider.CheckCollision(colliderEnemies))
            {
                GameManager.Instance.Player1.Life--;
                Engine.Debug("Bajar vida");
            }
        }
Пример #9
0
        private void EnemySpawner()
        {
            Random _random = new Random();
            float  num     = _random.Next(25, 775);
            float  x       = num;
            float  y       = -200;

            elapsedTime += Program.DeltaTime;
            if (ind < 30 && elapsedTime > enemySpawnRate)
            {
                elapsedTime = 0;
                Enemy enemy = new Enemy(new Vector2(x, y), 1f, 0f, 175f, 100);
                Enemies.Add(enemy);
                Engine.Debug(ind);
                ind++;
            }
        }
Пример #10
0
        public T Get()
        {
            T item;

            if (available.Count > 0)
            {
                Engine.Debug("Agarro del pool");
                item = available[0];
                available.Remove(item);
            }
            else
            {
                Engine.Debug("Creo");
                item = new T();
                item.OnDeactivate += OnDeactivateHandler;
            }

            inUse.Add(item);
            return(item);
        }
Пример #11
0
        public void LoadCsv()
        {
            if (File.Exists(path))
            {
                string   csv  = File.ReadAllText(path);
                string[] data = csv.Split(splitter);

                // Datos del jugador
                //Engine.Debug(data[0] + data[1]);

                GameMananger.HighScore = int.Parse(data[1]);


                Engine.Debug("Load Csv");
            }
            else
            {
                Engine.Debug("Archivo no encontrado");
            }
        }
Пример #12
0
        public Node AddNode(int value, Node node)
        {
            if (node == null)
            {
                node = new Node(value);
            }
            else if (value < node.value)
            {
                node.lesserNode = AddNode(value, node.lesserNode);
            }
            else if (value > node.value)
            {
                node.greaterNode = AddNode(value, node.greaterNode);
            }
            else
            {
                Engine.Debug("Dato ya existente");
            }

            return(node);
        }
Пример #13
0
 public void Release(T item)
 {
     Engine.Debug("Release");
     inUse.Remove(item);
     available.Add(item);
 }
Пример #14
0
 public void PickUp()
 {
     coin++;
     Engine.Debug("coin:" + coin);
     Destroy();
 }
Пример #15
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();
                }
            }
        }