diff --git a/.import/Scavengers_SpriteSheet.png-453d28febfc58649b3861793faca8d61.md5 b/.import/Scavengers_SpriteSheet.png-453d28febfc58649b3861793faca8d61.md5 index 5ced2a0..c6eda8b 100644 --- a/.import/Scavengers_SpriteSheet.png-453d28febfc58649b3861793faca8d61.md5 +++ b/.import/Scavengers_SpriteSheet.png-453d28febfc58649b3861793faca8d61.md5 @@ -1,3 +1,3 @@ source_md5="f992a46100220ca1148978becf8ffd19" -dest_md5="0a021db42e78a7aaa2f62cc44d31a75d" +dest_md5="e582a685861d1cd0ee17c31380287450" diff --git a/.import/Scavengers_SpriteSheet.png-453d28febfc58649b3861793faca8d61.stex b/.import/Scavengers_SpriteSheet.png-453d28febfc58649b3861793faca8d61.stex index b4cf663..7d2fb59 100644 Binary files a/.import/Scavengers_SpriteSheet.png-453d28febfc58649b3861793faca8d61.stex and b/.import/Scavengers_SpriteSheet.png-453d28febfc58649b3861793faca8d61.stex differ diff --git a/.import/golpeTextura.png-b65b8a77f934899b8a375d123244e5c7.md5 b/.import/golpeTextura.png-b65b8a77f934899b8a375d123244e5c7.md5 new file mode 100644 index 0000000..689a657 --- /dev/null +++ b/.import/golpeTextura.png-b65b8a77f934899b8a375d123244e5c7.md5 @@ -0,0 +1,3 @@ +source_md5="fc887ed65f3bbbacb44256ae7af33a5b" +dest_md5="bb6003e168929c8d91a0b22b6fa28392" + diff --git a/.import/golpeTextura.png-b65b8a77f934899b8a375d123244e5c7.stex b/.import/golpeTextura.png-b65b8a77f934899b8a375d123244e5c7.stex new file mode 100644 index 0000000..f62154b Binary files /dev/null and b/.import/golpeTextura.png-b65b8a77f934899b8a375d123244e5c7.stex differ diff --git a/.mono/metadata/scripts_metadata.editor b/.mono/metadata/scripts_metadata.editor index d68e0c7..dd7409b 100644 --- a/.mono/metadata/scripts_metadata.editor +++ b/.mono/metadata/scripts_metadata.editor @@ -1 +1 @@ -{"res://codigos/BoardManager.cs":{"modified_time":"1587848329","class":{"namespace":"","class_name":"BoardManager","nested":false}},"res://codigos/Enemy.cs":{"modified_time":"1588356725","class":{"namespace":"","class_name":"Enemy","nested":false}},"res://codigos/Escena_Principal.cs":{"modified_time":"1588085127","class":{"namespace":"","class_name":"Escena_Principal","nested":false}},"res://codigos/GameManager.cs":{"modified_time":"1588265510","class":{"namespace":"","class_name":"GameManager","nested":false}},"res://codigos/MovingObject.cs":{"modified_time":"1588535072","class":{"namespace":"","class_name":"MovingObject","nested":false}},"res://codigos/Player.cs":{"modified_time":"1588534166","class":{"namespace":"","class_name":"Player","nested":false}},"res://codigos/SingletonVariables.cs":{"modified_time":"1588182349","class":{"namespace":"","class_name":"SingletonVariables","nested":false}},"res://codigos/SuelosScript/Suelo1.cs":{"modified_time":"1587836811","class":{"namespace":"","class_name":"Suelo1","nested":false}},"res://codigos/Wall.cs":{"modified_time":"1588244399","class":{"namespace":"","class_name":"Wall","nested":false}}} \ No newline at end of file +{"res://codigos/BoardManager.cs":{"modified_time":"1588712203","class":{"namespace":"","class_name":"BoardManager","nested":false}},"res://codigos/Enemy.cs":{"modified_time":"1588763898","class":{"namespace":"","class_name":"Enemy","nested":false}},"res://codigos/Escena_Principal.cs":{"modified_time":"1588085127","class":{"namespace":"","class_name":"Escena_Principal","nested":false}},"res://codigos/GameManager.cs":{"modified_time":"1588763290","class":{"namespace":"","class_name":"GameManager","nested":false}},"res://codigos/MovingObject.cs":{"modified_time":"1588700252","class":{"namespace":"","class_name":"MovingObject","nested":false}},"res://codigos/Player.cs":{"modified_time":"1588763570","class":{"namespace":"","class_name":"Player","nested":false}},"res://codigos/SingletonVariables.cs":{"modified_time":"1588182349","class":{"namespace":"","class_name":"SingletonVariables","nested":false}},"res://codigos/SuelosScript/Suelo1.cs":{"modified_time":"1587836811","class":{"namespace":"","class_name":"Suelo1","nested":false}},"res://codigos/Wall.cs":{"modified_time":"1588762607","class":{"namespace":"","class_name":"Wall","nested":false}}} \ No newline at end of file diff --git a/.mono/metadata/scripts_metadata.editor_player b/.mono/metadata/scripts_metadata.editor_player index d68e0c7..dd7409b 100644 --- a/.mono/metadata/scripts_metadata.editor_player +++ b/.mono/metadata/scripts_metadata.editor_player @@ -1 +1 @@ -{"res://codigos/BoardManager.cs":{"modified_time":"1587848329","class":{"namespace":"","class_name":"BoardManager","nested":false}},"res://codigos/Enemy.cs":{"modified_time":"1588356725","class":{"namespace":"","class_name":"Enemy","nested":false}},"res://codigos/Escena_Principal.cs":{"modified_time":"1588085127","class":{"namespace":"","class_name":"Escena_Principal","nested":false}},"res://codigos/GameManager.cs":{"modified_time":"1588265510","class":{"namespace":"","class_name":"GameManager","nested":false}},"res://codigos/MovingObject.cs":{"modified_time":"1588535072","class":{"namespace":"","class_name":"MovingObject","nested":false}},"res://codigos/Player.cs":{"modified_time":"1588534166","class":{"namespace":"","class_name":"Player","nested":false}},"res://codigos/SingletonVariables.cs":{"modified_time":"1588182349","class":{"namespace":"","class_name":"SingletonVariables","nested":false}},"res://codigos/SuelosScript/Suelo1.cs":{"modified_time":"1587836811","class":{"namespace":"","class_name":"Suelo1","nested":false}},"res://codigos/Wall.cs":{"modified_time":"1588244399","class":{"namespace":"","class_name":"Wall","nested":false}}} \ No newline at end of file +{"res://codigos/BoardManager.cs":{"modified_time":"1588712203","class":{"namespace":"","class_name":"BoardManager","nested":false}},"res://codigos/Enemy.cs":{"modified_time":"1588763898","class":{"namespace":"","class_name":"Enemy","nested":false}},"res://codigos/Escena_Principal.cs":{"modified_time":"1588085127","class":{"namespace":"","class_name":"Escena_Principal","nested":false}},"res://codigos/GameManager.cs":{"modified_time":"1588763290","class":{"namespace":"","class_name":"GameManager","nested":false}},"res://codigos/MovingObject.cs":{"modified_time":"1588700252","class":{"namespace":"","class_name":"MovingObject","nested":false}},"res://codigos/Player.cs":{"modified_time":"1588763570","class":{"namespace":"","class_name":"Player","nested":false}},"res://codigos/SingletonVariables.cs":{"modified_time":"1588182349","class":{"namespace":"","class_name":"SingletonVariables","nested":false}},"res://codigos/SuelosScript/Suelo1.cs":{"modified_time":"1587836811","class":{"namespace":"","class_name":"Suelo1","nested":false}},"res://codigos/Wall.cs":{"modified_time":"1588762607","class":{"namespace":"","class_name":"Wall","nested":false}}} \ No newline at end of file diff --git a/.mono/temp/bin/Debug/Rogue en Godot.dll b/.mono/temp/bin/Debug/Rogue en Godot.dll index 856bef0..2ea1638 100644 Binary files a/.mono/temp/bin/Debug/Rogue en Godot.dll and b/.mono/temp/bin/Debug/Rogue en Godot.dll differ diff --git a/.mono/temp/bin/Debug/Rogue en Godot.pdb b/.mono/temp/bin/Debug/Rogue en Godot.pdb index a9a41d0..b73d4a2 100644 Binary files a/.mono/temp/bin/Debug/Rogue en Godot.pdb and b/.mono/temp/bin/Debug/Rogue en Godot.pdb differ diff --git a/.mono/temp/obj/Debug/Rogue en Godot.dll b/.mono/temp/obj/Debug/Rogue en Godot.dll index 856bef0..2ea1638 100644 Binary files a/.mono/temp/obj/Debug/Rogue en Godot.dll and b/.mono/temp/obj/Debug/Rogue en Godot.dll differ diff --git a/.mono/temp/obj/Debug/Rogue en Godot.pdb b/.mono/temp/obj/Debug/Rogue en Godot.pdb index a9a41d0..b73d4a2 100644 Binary files a/.mono/temp/obj/Debug/Rogue en Godot.pdb and b/.mono/temp/obj/Debug/Rogue en Godot.pdb differ diff --git a/animaciones/golpeWall.tres b/animaciones/golpeWall.tres new file mode 100644 index 0000000..eafad02 --- /dev/null +++ b/animaciones/golpeWall.tres @@ -0,0 +1,18 @@ +[gd_resource type="Animation" format=2] + +[resource] +resource_name = "golpeWall" +length = 0.09 +step = 0.01 +tracks/0/type = "value" +tracks/0/path = NodePath("..:rotation_degrees") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/keys = { +"times": PoolRealArray( 0, 0.04, 0.07, 0.09 ), +"transitions": PoolRealArray( 1, 1, 1, 1 ), +"update": 0, +"values": [ 0.0, 10.0, -10.0, 0.0 ] +} diff --git a/animaciones/tomarAlimento.tres b/animaciones/tomarAlimento.tres new file mode 100644 index 0000000..6173c6b --- /dev/null +++ b/animaciones/tomarAlimento.tres @@ -0,0 +1,53 @@ +[gd_resource type="Animation" format=2] + +[resource] +resource_name = "tomarSoda" +length = 0.6 +tracks/0/type = "value" +tracks/0/path = NodePath("..:scale") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/keys = { +"times": PoolRealArray( 0, 0.6 ), +"transitions": PoolRealArray( 1, 1 ), +"update": 0, +"values": [ Vector2( 1, 1 ), Vector2( 1.6, 1.6 ) ] +} +tracks/1/type = "value" +tracks/1/path = NodePath("..:modulate") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/keys = { +"times": PoolRealArray( 0.1, 0.6 ), +"transitions": PoolRealArray( 1, 1 ), +"update": 0, +"values": [ Color( 1, 1, 1, 1 ), Color( 1, 1, 1, 0 ) ] +} +tracks/2/type = "value" +tracks/2/path = NodePath("..:visible") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/keys = { +"times": PoolRealArray( 0, 0.6 ), +"transitions": PoolRealArray( 1, 1 ), +"update": 1, +"values": [ true, false ] +} +tracks/3/type = "value" +tracks/3/path = NodePath("..:z_index") +tracks/3/interp = 1 +tracks/3/loop_wrap = true +tracks/3/imported = false +tracks/3/enabled = true +tracks/3/keys = { +"times": PoolRealArray( 0, 0.1 ), +"transitions": PoolRealArray( 1, 1 ), +"update": 1, +"values": [ 1, 3 ] +} diff --git a/codigos/BoardManager.cs b/codigos/BoardManager.cs index 5d4234a..0acc44d 100644 --- a/codigos/BoardManager.cs +++ b/codigos/BoardManager.cs @@ -9,7 +9,20 @@ public class BoardManager : Node2D public int columns = 8;//numero de columnas [Export] public int rows = 8;//numero de filas + [Export] + public int FoodQuantityMIN = 1;//cantidad mínima de comida en un escneario + [Export] + public int FoodQuantityMAX = 5;//cantidad máxima de comida en un escneario + [Export] + public int wallQuantityMIN = 5;//cantidad mínima de obstaculos en un escneario + [Export] + public int wallQuantityMAX = 9;//cantidad máxima de obstaculos en un escneario + //Esto es para contolar la dificultad,puede verse en una grafica como ira aumentando paulantinamente dependiendo cuanto lo multiplique esta variable + [Export] + public int controlDificulty = 1;//esta variable se usa para multiplicar la función logaritmica que instancia cantidad de objetos y de esta forma poder aumentar o bajar la cantidad de enemigos,osea manejar la dificultad + + [Export] private Godot.Collections.Array floorTiles,outerWallTiles,wallTiles,foodTiles,EnemyTiles;//suelos empaquetados para precargar desde el editor [Export] @@ -19,6 +32,7 @@ public class BoardManager : Node2D private Sprite toInstantiate;//referencia a los bloques del suelo que seran instanciados private Node2D board;//para poner todos los suelos instanciados + public override void _Ready() { @@ -85,28 +99,38 @@ private void LayoutObjectAtRandomKinematicBody2D(Godot.Collections.Array scavengers_enemy = new Array();//cargo en este arreglo el recurso de audio enemigo,nota importante el arreglo de Godot es un Generico private AudioStreamPlayer scavengersEnemyNode;//referencia al nodo + Player hitPlayer;//la inicio vacia + + private AnimationPlayer AnimationPlayerEfectos;//referencia al animation player + // Called when the node enters the scene tree for the first time. public override void _Ready() { @@ -34,6 +38,9 @@ public override void _Ready() scavengersEnemyNode = (AudioStreamPlayer)GetTree().GetNodesInGroup("scavengers_enemy")[0];//busco el nodo que controla el audio scavengers_enemy.Add((AudioStreamOGGVorbis)GD.Load("res://musica/scavengers_enemy1.ogg"));//agrego el recurso de sonido scavengers_enemy.Add((AudioStreamOGGVorbis)GD.Load("res://musica/scavengers_enemy2.ogg"));//agrego el recurso de sonido + + //procesar animaciones de efectos + AnimationPlayerEfectos = (AnimationPlayer)GetTree().GetNodesInGroup("AnimationPlayerEfectos")[0]; } public override void _Process(float delta) @@ -90,14 +97,32 @@ protected override Vector2 RaycastDirection(int xDir, int Ydir)//cuando el rayca protected override void OnCantMoveRigidBody2D(KinematicBody2D go)//sino puede moverse por un kinematicbody como un personaje { - Player hitPlayer = (Player)go;//de esta forma tendria que acceder al script que tiene el personaje + GD.Print("enemigo colisionando con alguien"); + //parece que hay un bug cuando colisionan entre enemigos por eso verifico si esta en el grupo player el cuerpo kinematico + if(go.IsInGroup("Player"))//detectamos que esta en el grupo player para evitar un bug al solicionar los enemigos entre sí + { + hitPlayer = (Player)go;//de esta forma tendria que acceder al script que tiene el personaje + } + if(hitPlayer != null)//si estoy en la casilla player { hitPlayer.LoseFood(playerDamage);//descuento comida del personaje + playback.Travel("EnemyAttack");//el enemigo ataca cuando le quitamos puntos al jugador _GameManager.RandomizeSfx(scavengers_enemy,scavengersEnemyNode);//activo sonido golpe + if(hitPlayer.food >= 10)//si la comida del personaje es mayor o igual a 10 + { + AnimationPlayerEfectos.Play("pantallaRoja");//play color rojo en pantalla + AnimationPlayerEfectos.PlayBackwards("pantallaRoja");//play al reves color rojo en pantalla para que quede transparente + } } } + + + protected override void OncanMovePared()//si el enemigo choca contra la pared no hace nada + { + return;//salgo de la función + } // // Called every frame. 'delta' is the elapsed time since the previous frame. // public override void _Process(float delta) // { diff --git a/codigos/GameManager.cs b/codigos/GameManager.cs index b4ae51a..d6b53e9 100644 --- a/codigos/GameManager.cs +++ b/codigos/GameManager.cs @@ -22,6 +22,9 @@ public class GameManager : Node2D public bool doingSetup;//es para saber si todabia esta preparandose la escena,osea esta la UI que aparece en el comienzo private SingletonVariables _SingletonVariables; + Timer TimerReiniciarJuego; + + Player _MovingObject; // Called when the node enters the scene tree for the first time. public override void _Ready() { @@ -32,6 +35,7 @@ public override void _Ready() _SingletonVariables = GetNode("/root/SingletonVariables");//para acceder al singleton desde el player y cambiar el número del nivel y guardar el puntaje level = _SingletonVariables.level; + TimerReiniciarJuego = (Timer)GetTree().GetNodesInGroup("TimerReiniciarJuego")[0]; InitGame();//llamo al script que inicia el nivel lo hago desde escena principal @@ -66,19 +70,24 @@ public void _on_TimerlevelStarDelay_timeout()//cuando termina el tiempo del star - public void GameOver()//posiblemente esto despues voy a tener que correguirlo + public async void GameOver()//posiblemente esto despues voy a tener que correguirlo { + + //await ToSignal(GetTree().CreateTimer(0.5f), "timeout");//detengo por 1 segundo el flujo del código LevelText.Text = "After " + level + " Days\nyou starved";//si es game over cambio el texto fondoColorUI.Visible = true;//hago visible el fondo LevelText.Visible = true;//hace visible el texto Visible = false;//desactivo el nodo que contiene este script,esto tendria que desactivar el Game manager para saber que es Game over puede que lo haga de otra manera doingSetup = true;//si es Game over ya no puedo mover al jugador + await ToSignal(GetTree().CreateTimer(3.0f), "timeout");//detengo por 1 segundo el flujo del código + LevelText.Text = "The game reload \nin 5 second";//cambio la frase + TimerReiniciarJuego.Start();//inicio el timer para reiniciar el juego } private async void MoveEnemies()//esta función sera como una corrutina la utilizare para mover a los personajes cada cierto tiempo { enemiesMoving = true;//el enemigo se puede mover - await ToSignal(GetTree().CreateTimer(turnDelay),"timeout");//creo un timer que espera el tiempo que tenemos en la variable turnDelay...Esto puede cambiar + //await ToSignal(GetTree().CreateTimer(turnDelay),"timeout");//creo un timer que espera el tiempo que tenemos en la variable turnDelay...Esto puede cambiar if(enemies.Count == 0)//sino hay enemigos { await ToSignal(GetTree().CreateTimer(turnDelay),"timeout");//esperara este tiempo antes que pueda volver a moverse @@ -118,6 +127,13 @@ public void RandomizeSfx( Array clips,AudioStreamPlayer Sf SfxSource.Play();//doy play al sonido } + public void _on_TimerReiniciarJuego_timeout() + { + + GetTree().ReloadCurrentScene(); + _SingletonVariables.food = 100;//cambio los valores del singleton + _SingletonVariables.level = 1;//cambio los valores del singleton + } } diff --git a/codigos/MovingObject.cs b/codigos/MovingObject.cs index 05b9e12..2a52496 100644 --- a/codigos/MovingObject.cs +++ b/codigos/MovingObject.cs @@ -15,12 +15,14 @@ public abstract class MovingObject : KinematicBody2D//esta es una clase global q public bool enable;//para saber si el objeto puede estar enable y moverse public Tween moverConTween; public int dimensionSprite = 32; - private Vector2 raycastDirecciónAnterior; - private Vector2 RaycastDirecciónNueva; - - public Vector2 posicionDelRayo;//para saber hacia adonde tiene que apuntar el raycast + public bool colisionoConParedLateral = false; + + + private bool colisiono; + // Called when the node enters the scene tree for the first time. /*public override void _Ready()//no puedo implementar override desde player o enemigo por eso muevo todas estas variables del ready a cada script independiente + { movementSpeed = 1f / moveTime;//velocidad a la que se movera BoxCollider = GetNode("CollisionShape2D"); @@ -28,7 +30,7 @@ public abstract class MovingObject : KinematicBody2D//esta es una clase global q moverConTween = GetNode("Tween"); //rb2D = thi;por ahora voy a evitarla }*/ - bool colisiono; + //public bool colisiono; protected void SmoothMovementWithTween(Vector2 end)//Esta función va a procesar el movimiento en unity se usa una corrutina,pero en godot puede hacerce lo mismo con un nodo tween { @@ -37,61 +39,46 @@ protected void SmoothMovementWithTween(Vector2 end)//Esta función va a procesar "Position",//que propiedad quiero interpolar,osea la posición this.Position,//posición inicial end,//posicion final y multiplico por el tamaño del sprite,para esto tengo que hacer pruebas,pero creo que asi tendria que funcionar - 0.1f,//tiempo para ir de una posición a otra + moveTime,//tiempo para ir de una posición a otra Tween.TransitionType.Linear,//tipo de interpolación es Tween.TRANS_LINEAR Tween.EaseType.InOut//como termina la transición Tween.EASE_IN_OUT ); moverConTween.Start();//inicializo el nodo tween } + - //metodo para mover al jugador o al enemigo devuelve 2 si se movio y la colisión de raycast protected bool Move(int xDir, int yDir,RayCast2D hitRaycast)//es privada para cualquier otra clase que no hereda de esta { - bool colisiono;//para saber cuando el raycast colisiona Vector2 start = Position;//posicion inicial Vector2 end = start + new Vector2(xDir,yDir);//la posición de adonde queremos movernos suma de vectores (0,0) + (1,0) = (1,0) - hitRaycast.CastTo = RaycastDirection(xDir,yDir);//esto determina para adonde va apuntar el raycast - colisiono = hitRaycast.IsColliding();//esto es para verificar si colisionamos tengo que verificar utilizando la colisión del raycast con un grupo - GD.Print("el rayo esta colisionado: ", hitRaycast.IsColliding()); - GD.Print("direccion adonde apunta el raycast: ",RaycastDirection(xDir,yDir)); - GD.Print("posicion adonde me muevo: ",xDir," : ",yDir); - GD.Print("la dirección anterior del raycast: ",raycastDirecciónAnterior); - GD.Print("\n"); - //si hay un collider por donde pasa esa linea encontrado ese objeto - //&& xDir != RaycastDirection(xDir,Ydir).y && Ydir != RaycastDirection(xDir,Ydir).x *-1 + hitRaycast.CastTo = RaycastDirection(xDir,yDir);//esto determina para adonde va apuntar el raycast - /*if(!colisiono)//sino esta colisionando - { - SmoothMovementWithTween(end);//movemos con interpolación lineal recibe por parametro la ultima posición - raycastDirecciónAnterior = RaycastDirection(xDir,yDir); - return true; - }*/ + //nunca olvidarse de utilizar forceRAycastUpdate en un raycast,es como un tipo bug correguido para que detecte en el proximo frame la colisión + hitRaycast.ForceRaycastUpdate();//esto es muy importante para detectar colisiones con raycast,sino lo usamos posiblemente no funcione bien la colisión + /////////////////////////////////////////////////////////////////// - if(!colisiono || xDir != raycastDirecciónAnterior.y || yDir != raycastDirecciónAnterior.x * -1)//sino esta colisionando + if(!hitRaycast.IsColliding())//sino esta colisionando { SmoothMovementWithTween(end);//movemos con interpolación lineal recibe por parametro la ultima posición - raycastDirecciónAnterior = RaycastDirection(xDir,yDir); - return true; - } - if(colisiono)//si en la mascara 2 hay 1 personaje o un obstaculo - { - GD.Print("No podemos movernos"); - return false;//no hemos podido movernos + return true; } - //me faltaria una condición para verificar x con y osea si esta en X pero si tengo que girar la flecha - return false;//no hemos podido movernos - } + + + + + protected virtual bool AttempMove(int xDir,int yDir)//metodo para internar moverse esto recibe por parametro cuanto en x y cuanto en y lo marcamos como abstracto ya que esto lo haremos en cada personaje { RayCast2D hit = rayo;//tomo la referencia del nodo que esta en la función ready bool canMove = Move(xDir,yDir,hit);////si se puede mover o no + if(canMove) return true;//el personaje tendria que mover por lo tanto salgo de esta función Node col = (Node)hit.GetCollider();//usando la colisicioń del raycast busco el nodo @@ -100,6 +87,12 @@ protected virtual bool AttempMove(int xDir,int yDir)//metodo para internar mover //GD.Print("estoy conlisionado con un muro"); OnCantMoveStaticBody2D((StaticBody2D)hit.GetCollider());//aqui tengo que pasarle el staticbody que estamos colisionando } + + else if(col != null && col.IsInGroup("OuterWall"))//si esta en el grupo pared + { + OncanMovePared(); + } + else if(col != null && col.IsInGroup("characters"))//si el nodo colisionado esta enel grupo character { //GD.Print("estoy conlisionado con un personaje"); @@ -113,6 +106,7 @@ protected virtual bool AttempMove(int xDir,int yDir)//metodo para internar mover //Esto es relacionado al movimiento y al tipo de obstaculo protected abstract void OnCantMoveStaticBody2D(StaticBody2D go); //aqui viene el comportamiento luego de no poder moverse,es un meotdoABstracto ya que se va a comportar de diferente manera según sea el personaje o elenemigo protected abstract void OnCantMoveRigidBody2D(KinematicBody2D go); + protected abstract void OncanMovePared();//si colisiono con la pared de los laterales protected abstract Vector2 RaycastDirection(int xDir, int Ydir);//como el personaje y el enemigo tienen algunas diferencias tengo que procesar la direccioń del raycast en cada uno por separado diff --git a/codigos/Player.cs b/codigos/Player.cs index 38992d0..4cb085f 100644 --- a/codigos/Player.cs +++ b/codigos/Player.cs @@ -31,7 +31,7 @@ public class Player : MovingObject public float restardLevelDelay = 1f;//segundos antes de reiniciar o pasar al siguente nivel private AnimationTree animator;//referencia al nodo animationthree - private int food;//para llevar la cuenta de cuanta comida tiene + public int food;//para llevar la cuenta de cuanta comida tiene private AnimationNodeStateMachinePlayback playback;//referencia al nodo animation tree con el parametro para acceder a los stados private SingletonVariables _SingletonVariables; @@ -40,10 +40,13 @@ public class Player : MovingObject Wall hitWall;//referencia a la pared que esta chocando + // Called when the node enters the scene tree for the first time. public override void _Ready() { + //OS.CurrentScreen = 1;//para iniciar el juego en otro monitor y poder trabajar con 2 monitores + movementSpeed = 1f / moveTime;//velocidad a la que se movera BoxCollider = GetNode("CollisionShape2D"); rayo = GetNode("RayCast2D");//referencia al raycast @@ -83,21 +86,23 @@ protected override Vector2 RaycastDirection(int xDir, int Ydir)//cuando el rayca protected override bool AttempMove(int xDir, int yDir)//para mover el personaje { + bool canMove = base.AttempMove(xDir,yDir);//ejecuto esta acción del metodo base y devuelve verdadero o falso if(canMove)//si puede moverse { - food --;//en cada paso dismunuje la comida + food --;//en cada paso dismunuje la comida _FoodText.Text = "food " + food;//comida del jugador _GameManager.RandomizeSfx(scavengers_footstep,scavengersFootstepNode);//en cada paso hay un sonido de caminar } CheckIfGameOver();//siempre que se decrementa la comida verificamos si es game over _GameManager.playersTurn = false;//luego terminamos el turno del jugador + return canMove;//regresa si se movio o no } - public override void _Input(InputEvent @event) + public override void _PhysicsProcess(float delta)//pruebo con la función que posee propiedades físicas { - //GD.Print(rayo.IsColliding()); + if(!_GameManager.playersTurn || _GameManager.doingSetup)//si no es el turno del jugador o se esta inciando la escena con el menu { return;//dejamos de ejecutar y el personaje no se mueve @@ -106,31 +111,6 @@ public override void _Input(InputEvent @event) int horizontal = Convert.ToInt16((Input.GetActionStrength("d") - Input.GetActionStrength("a")) * dimensionSprite);//mover izquierda derecha int vertical = Convert.ToInt16((Input.GetActionStrength("s") - Input.GetActionStrength("w")) * dimensionSprite );//mover arriba abajo - /*if(Input.IsActionJustPressed("a")) - { - horizontal = -32; - } - - else if(Input.IsActionJustPressed("d")) - { - horizontal = 32; - } - - else if(Input.IsActionJustPressed("s")) - { - vertical = 32; - } - - else if(Input.IsActionJustPressed("w")) - { - vertical = -32; - } - - else - { - horizontal =0; - vertical = 0; - }*/ //posicionDelRayo = RaycastDirection(horizontal,vertical); if(horizontal != 0)//esto es para que NO se mueva en diagonal @@ -143,8 +123,6 @@ public override void _Input(InputEvent @event) //rayo.CastTo = RaycastDirection(horizontal,vertical); AttempMove(horizontal,vertical);//movemos el personaje } - - } @@ -152,6 +130,8 @@ protected override void OnCantMoveStaticBody2D(StaticBody2D pared)//si "NO" pode { if(pared.IsInGroup("Wall"))//si esta en el grupo suelo { + food --;//en cada paso dismunuje la comida + _FoodText.Text = "food " + food;//comida del jugador es disminuida hitWall = (Wall)pared.GetParent();//con esto tendria que poder acceder al script que maneja ese piso para cambiar la figura al ser golpeado } if(hitWall != null)//si el personaje esta chocando con un muro @@ -161,6 +141,13 @@ protected override void OnCantMoveStaticBody2D(StaticBody2D pared)//si "NO" pode playback.Travel("PlayerChop");//activo animación romper pared } } + protected override void OncanMovePared()//si estoy contra la pared y quiero moverme en su dirección descuento 1 de comida + { + food --;//en cada paso dismunuje la comida + _FoodText.Text = "food " + food;//comida del jugador es disminuida + return; + } + protected override void OnCantMoveRigidBody2D(KinematicBody2D body2D)//si "NO" podemos movernos recibe el cuerpo rigido y es un character.Este es un metodo que se sobreescribe { //esta función es para detectar kinematic como el enemigo,pero el enemigo @@ -204,7 +191,8 @@ public async void _on_Area2D_area_entered(Area _area)//esta funcion tiene una co food += pointPerFood;//sumo el puntaje de la comida _FoodText.Text = " + "+ pointPerFood +" food " + food;//comida del jugador (_area.GetParent().GetChild(0) as Area2D).Monitoring = false;//para que el cuerpo deje de ser detectado,porque aunque desaparesca el sprite sigue estando la colisión del area detectando cuerpos - (_area.GetParent() as Sprite).Visible = false;//hago invisible el nodo padre que contiene el sprite por lo tanto todos los hijos tendrian que ser inviisble + (_area.GetParent().GetChild(0) as Area2D).Monitoring = false;//para que el cuerpo deje de ser detectado,porque aunque desaparesca el sprite sigue estando la colisión del area detectando cuerpos + (_area.GetChild(1) as AnimationPlayer).Play("tomarAlimento");//busco el nodo hijo con indice 2 que es el animation player y activo la animación que hace desarparecer la soda } if(_area.IsInGroup("Soda")) { @@ -212,7 +200,8 @@ public async void _on_Area2D_area_entered(Area _area)//esta funcion tiene una co food += pointPerSOda;//sumo el puntaje de la soda _FoodText.Text = " + "+ pointPerSOda +" food " + food;//comida del jugador (_area.GetParent().GetChild(0) as Area2D).Monitoring = false;//para que el cuerpo deje de ser detectado,porque aunque desaparesca el sprite sigue estando la colisión del area detectando cuerpos - (_area.GetParent() as Sprite).Visible = false;//hago invisible el nodo padre que contiene el sprite por lo tanto todos los hijos tendrian que ser inviisble + (_area.GetChild(1) as AnimationPlayer).Play("tomarAlimento");//busco el nodo hijo con indice 2 que es el animation player y activo la animación que hace desarparecer la soda + } } diff --git a/codigos/Wall.cs b/codigos/Wall.cs index 7ce0eb8..e9eacea 100644 --- a/codigos/Wall.cs +++ b/codigos/Wall.cs @@ -13,6 +13,7 @@ public class Wall : Sprite //para procesar el sonido private Array scavengers_chop = new Array();//cargo en este arreglo el recurso de audio chop,nota importante el arreglo de Godot es un Generico private AudioStreamPlayer scavengersChopNode;//referencia al nodo + private AnimationPlayer _AnimationPlayer;//para buscar el animation player // Called when the node enters the scene tree for the first time. public override void _Ready() @@ -22,6 +23,7 @@ public override void _Ready() scavengersChopNode = (AudioStreamPlayer)GetTree().GetNodesInGroup("scavengers_chop")[0]; scavengers_chop.Add((AudioStreamOGGVorbis)GD.Load("res://musica/scavengers_chop1.ogg"));//guardo el audio precargado scavengers_chop.Add((AudioStreamOGGVorbis)GD.Load("res://musica/scavengers_chop2.ogg"));//guardo el audio precargado + _AnimationPlayer = GetNode("StaticBody2DWall/AnimationPlayer");//busco el animation player } @@ -31,6 +33,7 @@ public void DamageWall(int loss)//funcion publica que usara el personaje para da _GameManager.RandomizeSfx(scavengers_chop,scavengersChopNode);//activo sonido golpear Frame = indiceDmgSprite;//cuando es golpeado toma esta textura que esta en el indice DmgSprite hp -= loss;//descuento puntaje + _AnimationPlayer.Play("golpeWall");//activo la animación de movimiento if(hp<2) if(hp <= 0)//si el hp de esta columna es menor a cero { diff --git a/default_bus_layout.tres b/default_bus_layout.tres index dce6548..cb61415 100644 --- a/default_bus_layout.tres +++ b/default_bus_layout.tres @@ -1,7 +1,7 @@ [gd_resource type="AudioBusLayout" format=2] [resource] -bus/0/volume_db = -80.0 +bus/0/volume_db = -0.403803 bus/1/name = "music" bus/1/solo = false bus/1/mute = false diff --git a/escenas/Escena_Principal.tscn b/escenas/Escena_Principal.tscn index 4c7da9f..386659e 100644 --- a/escenas/Escena_Principal.tscn +++ b/escenas/Escena_Principal.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=7 format=2] +[gd_scene load_steps=8 format=2] [ext_resource path="res://escenas/characters/Player.tscn" type="PackedScene" id=1] [ext_resource path="res://escenas/ControlUI.tscn" type="PackedScene" id=2] @@ -7,6 +7,34 @@ [ext_resource path="res://escenas/GameManager.tscn" type="PackedScene" id=27] [ext_resource path="res://codigos/Escena_Principal.cs" type="Script" id=28] +[sub_resource type="Animation" id=1] +resource_name = "pantallaRoja" +length = 0.5 +tracks/0/type = "value" +tracks/0/path = NodePath("ColorRect:color") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/keys = { +"times": PoolRealArray( 0, 0.2, 0.3, 0.4 ), +"transitions": PoolRealArray( 1, 1, 1, 1 ), +"update": 0, +"values": [ Color( 1, 0.027451, 0.027451, 0 ), Color( 1, 0.027451, 0.027451, 0.447059 ), Color( 1, 0.027451, 0.027451, 0 ), Color( 1, 0.027451, 0.027451, 0.203922 ) ] +} +tracks/1/type = "value" +tracks/1/path = NodePath("../../../camara/Camera2D:zoom") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/keys = { +"times": PoolRealArray( 0, 0.1, 0.2, 0.3, 0.4 ), +"transitions": PoolRealArray( 1, 1, 1, 1, 1 ), +"update": 0, +"values": [ Vector2( 0.56, 0.53 ), Vector2( 0.54, 0.52 ), Vector2( 0.56, 0.53 ), Vector2( 0.54, 0.52 ), Vector2( 0.56, 0.53 ) ] +} + [node name="Escena_Principal" type="Node2D" groups=[ "Escena_Principal", ]] @@ -19,9 +47,9 @@ GameManager = ExtResource( 27 ) [node name="Camera2D" type="Camera2D" parent="camara"] position = Vector2( 0.773804, 0 ) -offset = Vector2( 120, 112 ) +offset = Vector2( 240, 112 ) current = true -zoom = Vector2( 0.54, 0.54 ) +zoom = Vector2( 0.56, 0.53 ) [node name="Board" type="Node2D" parent="." groups=[ "Board", @@ -33,10 +61,6 @@ zoom = Vector2( 0.54, 0.54 ) one_shot = true autostart = true -[node name="Canvas" type="CanvasLayer" parent="."] - -[node name="ControlUI" parent="Canvas" instance=ExtResource( 2 )] - [node name="Audio_Y_Sfx" type="Node" parent="."] [node name="MusicGame" type="AudioStreamPlayer" parent="Audio_Y_Sfx" groups=[ @@ -76,4 +100,44 @@ bus = "scavengers_die" "scavengers_enemy", ]] bus = "scavengers_enemy" + +[node name="TimerReiniciarJuego" type="Timer" parent="." groups=[ +"TimerReiniciarJuego", +]] +wait_time = 5.0 +one_shot = true + +[node name="ViewportContainer" type="ViewportContainer" parent="."] +margin_right = 40.0 +margin_bottom = 40.0 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Canvas" type="CanvasLayer" parent="ViewportContainer"] + +[node name="ControlUI" parent="ViewportContainer/Canvas" instance=ExtResource( 2 )] + +[node name="CanvasAnimacion" type="CanvasLayer" parent="ViewportContainer"] + +[node name="ControlEfectosEspeciales" type="Control" parent="ViewportContainer/CanvasAnimacion"] +anchor_right = 1.0 +anchor_bottom = 1.0 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="ColorRect" type="ColorRect" parent="ViewportContainer/CanvasAnimacion/ControlEfectosEspeciales"] +anchor_right = 1.0 +anchor_bottom = 1.0 +color = Color( 1, 0.027451, 0.027451, 0 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="AnimationPlayerEfectos" type="AnimationPlayer" parent="ViewportContainer/CanvasAnimacion/ControlEfectosEspeciales" groups=[ +"AnimationPlayerEfectos", +]] +anims/pantallaRoja = SubResource( 1 ) [connection signal="timeout" from="TimerlevelStarDelay" to="GameManager" method="_on_TimerlevelStarDelay_timeout"] +[connection signal="timeout" from="TimerReiniciarJuego" to="GameManager" method="_on_TimerReiniciarJuego_timeout"] diff --git a/escenas/FloorScene/Food.tscn b/escenas/FloorScene/Food.tscn index 39e2681..12abd34 100644 --- a/escenas/FloorScene/Food.tscn +++ b/escenas/FloorScene/Food.tscn @@ -1,6 +1,7 @@ -[gd_scene load_steps=3 format=2] +[gd_scene load_steps=4 format=2] [ext_resource path="res://sprite/Scavengers_SpriteSheet.png" type="Texture" id=1] +[ext_resource path="res://animaciones/tomarAlimento.tres" type="Animation" id=2] [sub_resource type="RectangleShape2D" id=1] extents = Vector2( 15.9082, 15.8257 ) @@ -20,3 +21,6 @@ frame = 19 [node name="CollisionShape2D" type="CollisionShape2D" parent="Area2DFood"] shape = SubResource( 1 ) + +[node name="AnimationPlayer" type="AnimationPlayer" parent="Area2DFood"] +anims/tomarAlimento = ExtResource( 2 ) diff --git a/escenas/FloorScene/OuterWall.tscn b/escenas/FloorScene/OuterWall.tscn index a6b4b87..2ffc3a9 100644 --- a/escenas/FloorScene/OuterWall.tscn +++ b/escenas/FloorScene/OuterWall.tscn @@ -5,15 +5,15 @@ [sub_resource type="RectangleShape2D" id=1] extents = Vector2( 15.9082, 15.8257 ) -[node name="OuterWall" type="Sprite" groups=[ -"BlockingLayer", -]] +[node name="OuterWall" type="Sprite"] texture = ExtResource( 1 ) vframes = 7 hframes = 8 frame = 25 -[node name="StaticBody2D" type="StaticBody2D" parent="."] +[node name="StaticBody2D" type="StaticBody2D" parent="." groups=[ +"OuterWall", +]] collision_layer = 3 [node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2D"] diff --git a/escenas/FloorScene/OuterWall2.tscn b/escenas/FloorScene/OuterWall2.tscn index dd2ecbe..8603bdc 100644 --- a/escenas/FloorScene/OuterWall2.tscn +++ b/escenas/FloorScene/OuterWall2.tscn @@ -5,15 +5,15 @@ [sub_resource type="RectangleShape2D" id=1] extents = Vector2( 15.9082, 15.8257 ) -[node name="OuterWall2" type="Sprite" groups=[ -"BlockingLayer", -]] +[node name="OuterWall2" type="Sprite"] texture = ExtResource( 1 ) vframes = 7 hframes = 8 frame = 26 -[node name="StaticBody2D" type="StaticBody2D" parent="."] +[node name="StaticBody2D" type="StaticBody2D" parent="." groups=[ +"OuterWall", +]] collision_layer = 3 [node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2D"] diff --git a/escenas/FloorScene/OuterWall3.tscn b/escenas/FloorScene/OuterWall3.tscn index d17e553..f16ada2 100644 --- a/escenas/FloorScene/OuterWall3.tscn +++ b/escenas/FloorScene/OuterWall3.tscn @@ -5,15 +5,15 @@ [sub_resource type="RectangleShape2D" id=1] extents = Vector2( 15.9082, 15.8257 ) -[node name="OuterWall3" type="Sprite" groups=[ -"BlockingLayer", -]] +[node name="OuterWall3" type="Sprite"] texture = ExtResource( 1 ) vframes = 7 hframes = 8 frame = 28 -[node name="StaticBody2D" type="StaticBody2D" parent="."] +[node name="StaticBody2D" type="StaticBody2D" parent="." groups=[ +"OuterWall", +]] collision_layer = 3 [node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2D"] diff --git a/escenas/FloorScene/OuterWall4.tscn b/escenas/FloorScene/OuterWall4.tscn new file mode 100644 index 0000000..5976c0a --- /dev/null +++ b/escenas/FloorScene/OuterWall4.tscn @@ -0,0 +1,20 @@ +[gd_scene load_steps=3 format=2] + +[ext_resource path="res://sprite/Scavengers_SpriteSheet.png" type="Texture" id=1] + +[sub_resource type="RectangleShape2D" id=1] +extents = Vector2( 15.9082, 15.8257 ) + +[node name="OuterWall4" type="Sprite"] +texture = ExtResource( 1 ) +vframes = 7 +hframes = 8 +frame = 29 + +[node name="StaticBody2D" type="StaticBody2D" parent="." groups=[ +"OuterWall", +]] +collision_layer = 3 + +[node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2D"] +shape = SubResource( 1 ) diff --git a/escenas/FloorScene/Soda.tscn b/escenas/FloorScene/Soda.tscn index 0211641..1b259c1 100644 --- a/escenas/FloorScene/Soda.tscn +++ b/escenas/FloorScene/Soda.tscn @@ -1,6 +1,7 @@ -[gd_scene load_steps=3 format=2] +[gd_scene load_steps=4 format=2] [ext_resource path="res://sprite/Scavengers_SpriteSheet.png" type="Texture" id=1] +[ext_resource path="res://animaciones/tomarAlimento.tres" type="Animation" id=2] [sub_resource type="RectangleShape2D" id=1] extents = Vector2( 15.9082, 15.8257 ) @@ -20,3 +21,6 @@ frame = 18 [node name="CollisionShape2D" type="CollisionShape2D" parent="Area2DSoda"] shape = SubResource( 1 ) + +[node name="AnimationPlayer" type="AnimationPlayer" parent="Area2DSoda"] +anims/tomarAlimento = ExtResource( 2 ) diff --git a/escenas/FloorScene/Wall.tscn b/escenas/FloorScene/Wall.tscn index ca9c13a..9edaa88 100644 --- a/escenas/FloorScene/Wall.tscn +++ b/escenas/FloorScene/Wall.tscn @@ -1,7 +1,8 @@ -[gd_scene load_steps=4 format=2] +[gd_scene load_steps=5 format=2] [ext_resource path="res://sprite/Scavengers_SpriteSheet.png" type="Texture" id=1] [ext_resource path="res://codigos/Wall.cs" type="Script" id=2] +[ext_resource path="res://animaciones/golpeWall.tres" type="Animation" id=3] [sub_resource type="RectangleShape2D" id=1] extents = Vector2( 15.9082, 15.8257 ) @@ -25,3 +26,6 @@ collision_layer = 2 [node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2DWall"] shape = SubResource( 1 ) + +[node name="AnimationPlayer" type="AnimationPlayer" parent="StaticBody2DWall"] +anims/golpeWall = ExtResource( 3 ) diff --git a/escenas/FloorScene/Wall2.tscn b/escenas/FloorScene/Wall2.tscn index bf47c46..d3bea18 100644 --- a/escenas/FloorScene/Wall2.tscn +++ b/escenas/FloorScene/Wall2.tscn @@ -1,7 +1,8 @@ -[gd_scene load_steps=4 format=2] +[gd_scene load_steps=5 format=2] [ext_resource path="res://sprite/Scavengers_SpriteSheet.png" type="Texture" id=1] [ext_resource path="res://codigos/Wall.cs" type="Script" id=2] +[ext_resource path="res://animaciones/golpeWall.tres" type="Animation" id=3] [sub_resource type="RectangleShape2D" id=1] extents = Vector2( 15.9082, 15.8257 ) @@ -25,3 +26,6 @@ collision_layer = 2 [node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2DWall"] shape = SubResource( 1 ) + +[node name="AnimationPlayer" type="AnimationPlayer" parent="StaticBody2DWall"] +anims/golpeWall = ExtResource( 3 ) diff --git a/escenas/FloorScene/Wall3.tscn b/escenas/FloorScene/Wall3.tscn index 8b76c8a..0efa9c6 100644 --- a/escenas/FloorScene/Wall3.tscn +++ b/escenas/FloorScene/Wall3.tscn @@ -1,7 +1,8 @@ -[gd_scene load_steps=4 format=2] +[gd_scene load_steps=5 format=2] [ext_resource path="res://sprite/Scavengers_SpriteSheet.png" type="Texture" id=1] [ext_resource path="res://codigos/Wall.cs" type="Script" id=2] +[ext_resource path="res://animaciones/golpeWall.tres" type="Animation" id=3] [sub_resource type="RectangleShape2D" id=1] extents = Vector2( 15.9082, 15.8257 ) @@ -25,3 +26,6 @@ collision_layer = 2 [node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2DWall"] shape = SubResource( 1 ) + +[node name="AnimationPlayer" type="AnimationPlayer" parent="StaticBody2DWall"] +anims/golpeWall = ExtResource( 3 ) diff --git a/escenas/FloorScene/Wall4.tscn b/escenas/FloorScene/Wall4.tscn index be346c7..f440e10 100644 --- a/escenas/FloorScene/Wall4.tscn +++ b/escenas/FloorScene/Wall4.tscn @@ -1,7 +1,8 @@ -[gd_scene load_steps=4 format=2] +[gd_scene load_steps=5 format=2] [ext_resource path="res://sprite/Scavengers_SpriteSheet.png" type="Texture" id=1] [ext_resource path="res://codigos/Wall.cs" type="Script" id=2] +[ext_resource path="res://animaciones/golpeWall.tres" type="Animation" id=3] [sub_resource type="RectangleShape2D" id=1] extents = Vector2( 15.9082, 15.8257 ) @@ -25,3 +26,6 @@ collision_layer = 2 [node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2DWall"] shape = SubResource( 1 ) + +[node name="AnimationPlayer" type="AnimationPlayer" parent="StaticBody2DWall"] +anims/golpeWall = ExtResource( 3 ) diff --git a/escenas/FloorScene/Wall5.tscn b/escenas/FloorScene/Wall5.tscn index 87d62aa..98b0f52 100644 --- a/escenas/FloorScene/Wall5.tscn +++ b/escenas/FloorScene/Wall5.tscn @@ -1,7 +1,8 @@ -[gd_scene load_steps=4 format=2] +[gd_scene load_steps=5 format=2] [ext_resource path="res://sprite/Scavengers_SpriteSheet.png" type="Texture" id=1] [ext_resource path="res://codigos/Wall.cs" type="Script" id=2] +[ext_resource path="res://animaciones/golpeWall.tres" type="Animation" id=3] [sub_resource type="RectangleShape2D" id=1] extents = Vector2( 15.9082, 15.8257 ) @@ -25,3 +26,6 @@ collision_layer = 2 [node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2DWall"] shape = SubResource( 1 ) + +[node name="AnimationPlayer" type="AnimationPlayer" parent="StaticBody2DWall"] +anims/golpeWall = ExtResource( 3 ) diff --git a/escenas/FloorScene/Wall6.tscn b/escenas/FloorScene/Wall6.tscn index 91dde03..7f56cc6 100644 --- a/escenas/FloorScene/Wall6.tscn +++ b/escenas/FloorScene/Wall6.tscn @@ -1,7 +1,8 @@ -[gd_scene load_steps=4 format=2] +[gd_scene load_steps=5 format=2] [ext_resource path="res://sprite/Scavengers_SpriteSheet.png" type="Texture" id=1] [ext_resource path="res://codigos/Wall.cs" type="Script" id=2] +[ext_resource path="res://animaciones/golpeWall.tres" type="Animation" id=3] [sub_resource type="RectangleShape2D" id=1] extents = Vector2( 15.9082, 15.8257 ) @@ -14,9 +15,9 @@ z_index = 1 texture = ExtResource( 1 ) vframes = 7 hframes = 8 -frame = 28 +frame = 31 script = ExtResource( 2 ) -indiceDmgSprite = 28 +indiceDmgSprite = 54 [node name="StaticBody2DWall" type="StaticBody2D" parent="." groups=[ "Wall", @@ -25,3 +26,6 @@ collision_layer = 2 [node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2DWall"] shape = SubResource( 1 ) + +[node name="AnimationPlayer" type="AnimationPlayer" parent="StaticBody2DWall"] +anims/golpeWall = ExtResource( 3 ) diff --git a/escenas/FloorScene/Wall7.tscn b/escenas/FloorScene/Wall7.tscn index 9ba0817..51cb224 100644 --- a/escenas/FloorScene/Wall7.tscn +++ b/escenas/FloorScene/Wall7.tscn @@ -1,7 +1,8 @@ -[gd_scene load_steps=4 format=2] +[gd_scene load_steps=5 format=2] [ext_resource path="res://sprite/Scavengers_SpriteSheet.png" type="Texture" id=1] [ext_resource path="res://codigos/Wall.cs" type="Script" id=2] +[ext_resource path="res://animaciones/golpeWall.tres" type="Animation" id=3] [sub_resource type="RectangleShape2D" id=1] extents = Vector2( 15.9082, 15.8257 ) @@ -25,3 +26,6 @@ collision_layer = 2 [node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2DWall"] shape = SubResource( 1 ) + +[node name="AnimationPlayer" type="AnimationPlayer" parent="StaticBody2DWall"] +anims/golpeWall = ExtResource( 3 ) diff --git a/escenas/FloorScene/Wall8.tscn b/escenas/FloorScene/Wall8.tscn index de9dceb..f1d093f 100644 --- a/escenas/FloorScene/Wall8.tscn +++ b/escenas/FloorScene/Wall8.tscn @@ -1,7 +1,8 @@ -[gd_scene load_steps=4 format=2] +[gd_scene load_steps=5 format=2] [ext_resource path="res://sprite/Scavengers_SpriteSheet.png" type="Texture" id=1] [ext_resource path="res://codigos/Wall.cs" type="Script" id=2] +[ext_resource path="res://animaciones/golpeWall.tres" type="Animation" id=3] [sub_resource type="RectangleShape2D" id=1] extents = Vector2( 15.9082, 15.8257 ) @@ -25,3 +26,6 @@ collision_layer = 2 [node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2DWall"] shape = SubResource( 1 ) + +[node name="AnimationPlayer" type="AnimationPlayer" parent="StaticBody2DWall"] +anims/golpeWall = ExtResource( 3 ) diff --git a/escenas/GameManager.tscn b/escenas/GameManager.tscn index bed0eca..216da01 100644 --- a/escenas/GameManager.tscn +++ b/escenas/GameManager.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=27 format=2] +[gd_scene load_steps=28 format=2] [ext_resource path="res://escenas/FloorScene/Floor5.tscn" type="PackedScene" id=1] [ext_resource path="res://escenas/FloorScene/Floor7.tscn" type="PackedScene" id=2] @@ -26,6 +26,7 @@ [ext_resource path="res://escenas/FloorScene/Wall2.tscn" type="PackedScene" id=24] [ext_resource path="res://escenas/FloorScene/Soda.tscn" type="PackedScene" id=25] [ext_resource path="res://escenas/characters/Enemy1.tscn" type="PackedScene" id=26] +[ext_resource path="res://escenas/FloorScene/OuterWall4.tscn" type="PackedScene" id=27] [node name="GameManager" type="Node2D" groups=[ "GameManager", @@ -36,8 +37,13 @@ script = ExtResource( 8 ) "BoardManager", ]] script = ExtResource( 9 ) +columns = 16 +FoodQuantityMAX = 7 +wallQuantityMIN = 10 +wallQuantityMAX = 20 +controlDificulty = 2 floorTiles = [ ExtResource( 7 ), ExtResource( 19 ), ExtResource( 16 ), ExtResource( 17 ), ExtResource( 1 ), ExtResource( 3 ), ExtResource( 2 ), ExtResource( 15 ), ExtResource( 11 ) ] -outerWallTiles = [ ExtResource( 12 ), ExtResource( 13 ), ExtResource( 14 ) ] +outerWallTiles = [ ExtResource( 12 ), ExtResource( 13 ), ExtResource( 14 ), ExtResource( 27 ) ] wallTiles = [ ExtResource( 20 ), ExtResource( 24 ), ExtResource( 5 ), ExtResource( 21 ), ExtResource( 18 ), ExtResource( 4 ), ExtResource( 6 ), ExtResource( 20 ) ] foodTiles = [ ExtResource( 22 ), ExtResource( 25 ) ] EnemyTiles = [ ExtResource( 26 ), ExtResource( 10 ) ] diff --git a/sprite/Scavengers_SpriteSheet.png.import b/sprite/Scavengers_SpriteSheet.png.import index 6576e67..c7cfbfa 100644 --- a/sprite/Scavengers_SpriteSheet.png.import +++ b/sprite/Scavengers_SpriteSheet.png.import @@ -21,11 +21,11 @@ compress/bptc_ldr=0 compress/normal_map=0 flags/repeat=0 flags/filter=false -flags/mipmaps=false -flags/anisotropic=false +flags/mipmaps=true +flags/anisotropic=true flags/srgb=2 process/fix_alpha_border=true -process/premult_alpha=false +process/premult_alpha=true process/HDR_as_SRGB=false process/invert_color=false stream=false diff --git a/sprite/golpeTextura.png b/sprite/golpeTextura.png new file mode 100644 index 0000000..8b49511 Binary files /dev/null and b/sprite/golpeTextura.png differ diff --git a/sprite/golpeTextura.png.import b/sprite/golpeTextura.png.import new file mode 100644 index 0000000..a60233d --- /dev/null +++ b/sprite/golpeTextura.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/golpeTextura.png-b65b8a77f934899b8a375d123244e5c7.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://sprite/golpeTextura.png" +dest_files=[ "res://.import/golpeTextura.png-b65b8a77f934899b8a375d123244e5c7.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0