En esta sección se realizará el seguimiento de los proyectos de semestre, con los respectivos avances periódicos según lo definido en la metodología SCRUM.
Moderator: julianmartinez16
-
EliteP
- Posts: 29
- Joined: Thu Jul 18, 2019 9:31 am
Post
by EliteP » Thu Sep 19, 2019 5:38 am
Codigo del movimiento del personaje mejorado
Code: Select all
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class PlayerController : MonoBehaviour
{
public int Puntaje = 1;
public float speed = 2f; //Permite elegir la velocidad
public float maxSpeed = 5f; //Establece un valor maximo de velocidad
public bool grounded; // booleanos que permite muestra si se encuentra o no en "el suelo"
public float jumpPower = 6.5f;//Permite elegir la distancia del salto
private Rigidbody2D rb2d;
private Animator anim; //Permite la animacion
private bool jump;
// Start is called before the first frame update
void Start()
{
rb2d = GetComponent<Rigidbody2D>();
anim = GetComponent<Animator>();
}
// Update is called once per frame
void Update()
{
anim.SetFloat("Speed", Mathf.Abs(rb2d.velocity.x)); //Determina si se encuentra o no en el suelo y permite o no realizar un salto
anim.SetBool("Grounded", grounded);
if (Input.GetKeyDown(KeyCode.UpArrow) && grounded)
{
jump = true;
}
}
private void FixedUpdate()
{
float h = Input.GetAxis("Horizontal");
rb2d.AddForce(Vector2.right * speed * h); //Determina las direcciones con respecto a la velocidad
if (rb2d.velocity.x > maxSpeed)
{
rb2d.velocity = new Vector2(maxSpeed, rb2d.velocity.y);
}
if (rb2d.velocity.x < -maxSpeed)
{
rb2d.velocity = new Vector2(-maxSpeed, rb2d.velocity.y);
}
if (h > 0.1f)
{
transform.localScale = new Vector3(1f, 1f, 1f);
}
if (h< -0.1f)
{
transform.localScale = new Vector3(-1f, 1f, 1f);
}
if (jump)
{
rb2d.AddForce(Vector2.up * jumpPower, ForceMode2D.Impulse); //Determinar la distancia de salto
jump = false;
}
Debug.Log(rb2d.velocity.x);
}
void OnTriggerEnter2D(Collider2D other)
{
if (other.gameObject.CompareTag("PickUp")) //Al colisionar con el objeto con dicha Tag este se desactivara
{
other.gameObject.SetActive(false);
ControlPuntos.Score += Puntaje; //Al colisionar con este objeto tambien sumara +1 al puntaje
}
}
}
Emanuel Perez, estudiante
"Keelah Se'lai"
-
EliteP
- Posts: 29
- Joined: Thu Jul 18, 2019 9:31 am
Post
by EliteP » Thu Sep 19, 2019 5:48 am
Gameplay
Emanuel Perez, estudiante
"Keelah Se'lai"
-
EliteP
- Posts: 29
- Joined: Thu Jul 18, 2019 9:31 am
Post
by EliteP » Thu Sep 19, 2019 8:45 am
Pitch
Last edited by
EliteP on Thu Oct 24, 2019 6:55 am, edited 1 time in total.
Emanuel Perez, estudiante
"Keelah Se'lai"
-
EliteP
- Posts: 29
- Joined: Thu Jul 18, 2019 9:31 am
Post
by EliteP » Tue Sep 24, 2019 10:32 pm
¿Qué hemos hecho?
Se termino hizo que el primer nivel fuera completable
Se añadio un enemigo con su movimiento
Utilizamos nuevos assets para el juego
Se agrego puntuacion
Se agrego un coleccionable que agrega puntuacion
¿Qué vamos a hacer?
Programar el HUB de vida
Hacer que el menu funcione y te lleve al primer nivel
Hacer un FeedBack para la vida para que se note que el personaje pierde salud
¿Qué dificultades hemos tenido?
Aparte de que se tuvieron que cambiar algunos codigos porque daban errores,ninguna
Sprint 09
Inicio: 19/09/2019
Final: 26/09/2019
Tareas
Mirar el video de la semana(todos)
Programar el HUB de vida (Emanuel)
Programar FeedBack de la vida(Juan)
Hacer el menu de inicio funcional
Last edited by
EliteP on Fri Sep 27, 2019 12:39 am, edited 2 times in total.
Emanuel Perez, estudiante
"Keelah Se'lai"
-
EliteP
- Posts: 29
- Joined: Thu Jul 18, 2019 9:31 am
Post
by EliteP » Wed Sep 25, 2019 3:34 am
Se creo un Collider con una tag que al colisionar con el reinicie al personaje a su posicion inicial utilizando la guia del video 14
El codigo que se utilizo fue el siguiente en el player controller
Code: Select all
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class PlayerController : MonoBehaviour
{
public int Puntaje = 1;
public float speed = 2f; //Permite elegir la velocidad
public float maxSpeed = 5f; //Establece un valor maximo de velocidad
public bool grounded; // booleanos que permite muestra si se encuentra o no en "el suelo"
public float jumpPower = 6.5f;//Permite elegir la distancia del salto
private Rigidbody2D rb2d;
private Animator anim; //Permite la animacion
private bool jump;
private Vector2 pos_0; //Declara la variable
//public const string MUERTE = "Muerte";
// Start is called before the first frame update
void Start()
{
pos_0 = this.transform.position; //Determina la posicion inicial
rb2d = GetComponent<Rigidbody2D>();
anim = GetComponent<Animator>();
}
// Update is called once per frame
void Update()
{
anim.SetFloat("Speed", Mathf.Abs(rb2d.velocity.x)); //Determina si se encuentra o no en el suelo y permite o no realizar un salto
anim.SetBool("Grounded", grounded);
if (Input.GetKeyDown(KeyCode.UpArrow) && grounded)
{
jump = true;
}
}
private void FixedUpdate()
{
float h = Input.GetAxis("Horizontal");
rb2d.AddForce(Vector2.right * speed * h); //Determina las direcciones con respecto a la velocidad
if (rb2d.velocity.x > maxSpeed)
{
rb2d.velocity = new Vector2(maxSpeed, rb2d.velocity.y);
}
if (rb2d.velocity.x < -maxSpeed)
{
rb2d.velocity = new Vector2(-maxSpeed, rb2d.velocity.y);
}
if (h > 0.1f)
{
transform.localScale = new Vector3(1f, 1f, 1f);
}
if (h< -0.1f)
{
transform.localScale = new Vector3(-1f, 1f, 1f);
}
if (jump)
{
rb2d.AddForce(Vector2.up * jumpPower, ForceMode2D.Impulse); //Determinar la distancia de salto
jump = false;
}
Debug.Log(rb2d.velocity.x);
}
void OnTriggerEnter2D(Collider2D other)
{
if (other.gameObject.CompareTag("PickUp")) //Al colisionar con el objeto con dicha Tag este se desactivara
{
other.gameObject.SetActive(false);
ControlPuntos.Score += Puntaje; //Al colisionar con este objeto tambien sumara +1 al puntaje
}
if (other.gameObject.Equals("Muerte")) //Reinicia la posicion al colicionar
{
this.transform.position = pos_0;
}
}
}
En especifico este:

Emanuel Perez, estudiante
"Keelah Se'lai"
-
EliteP
- Posts: 29
- Joined: Thu Jul 18, 2019 9:31 am
Post
by EliteP » Wed Sep 25, 2019 4:15 am
Se agrego un HUB de vida por corazones
Utilizaremos un HUB de vida de corazones(por lo menos de momento) para mostrar la vida del personaje al jugador
Tambien adjunto la imagen del GameController que "quita" la vida visualmente
Se asigna un tamaño de corazones y se agregan en los public's la posicion de los corazones que van a desaparecer(son imagenes en el canvas)
Y el codigo del GameController es el siguiente:
Code: Select all
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Vida2 : MonoBehaviour
{
public GameObject[] corazones; //Permite agregar un conjunto de entidades publicas dependiendo del valor agregado
public int vida = 5; //Permite modificar la cantidad de vida
public static Vida2 Corazones;
// Start is called before the first frame update
void Start()
{
Corazones = this; //Hace que empiece con la cantidad de corazones asignados
}
// Update is called once per frame
void Update()
{
}
public void AgregarVida() //Codigo usado para agregar vida con algun Pick Up(Se usara mas adelante)
{
if (vida >= 5)
return;
corazones[vida].SetActive(true);
vida += 1;
}
public void QuitarVida() //Codigo que hace que pierda vida al colisionar(esta determinado en el codigo "VidaPlayer")
{
if (vida <= 0)
return;
vida -= 1;
corazones[vida].SetActive(false);
}
public void QuitarVida2() //Codigo usado para hacer "InstaKill"
{
if (vida <= 0)
return;
vida -= 100;
corazones[vida].SetActive(false);
}
}
Un vistazo rapido de como el personaje pierde vida contra uno de los enemigos
Codigo que hace perder vida que se habia subido antes al blog pero que vuelvo a subir por comodidad:
Tambien se realizaron ajustes y se agregaron notas de guia(//)
Code: Select all
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
public class VidaPlayer : MonoBehaviour
{
public int vida; //Agrega una vida
public float restartDelay = 1f; //Tiempo para que se reinicie la escena
// Start is called before the first frame update
void Start()
{
if (vida <= 0)
{
StartCoroutine(RestartGame());
}
}
// Update is called once per frame
void Update()
{
}
public void OnTriggerEnter2D(Collider2D col) //Determina que al colicionar con la Tag asiganada quite vida
{
if (col.tag == "Enemigo")
{
Vida2.Corazones.QuitarVida();
vida = Vida2.Corazones.vida;
}
if (col.tag == "Muerte")
{
//Vida2.Corazones.QuitarVida2();
//vida = Vida2.Corazones.vida;
}
if (vida <= 0) //Al perder toda la vida el jugador se destruye
{
gameObject.SetActive(false);
//GameOverManager.gameOverManager.CallGameOver();
}
if (vida <= 0) //Al perder toda la vida se reinica el juego
{
StartCoroutine(RestartGame());
}
}
public IEnumerator RestartGame() //Hace que el juego se reinicie
{
yield return new WaitForSeconds(2f);
SceneManager.LoadScene(SceneManager.GetActiveScene().name);
}
}
Emanuel Perez, estudiante
"Keelah Se'lai"
-
Awaketo
- Posts: 29
- Joined: Thu Jul 18, 2019 9:29 am
Post
by Awaketo » Thu Sep 26, 2019 11:59 pm
Se buscaba intentar hacer un feedback al usuario para cuando recibe daño, que el personaje principal haga un knock back al tocarse con el enemigo, el código utilizado para el enemigo fue este:

Código que define cuanto cuanta va ser la distancia que arroje al jugador.
El código usado para el player es este:

En este còdigo define la direcciòn en la que el jugador va salir "disparado" cuando lo toque.
Pero por algun extraño motivo no funciona, creo que tocarà rehacer el sistema de movimiento de los enemigos.
Juan Osorio Ceballos
Estudiante de fundamentos de programación.
Gyga Tryhard
-
MateoLC
- Posts: 12
- Joined: Thu Jul 18, 2019 9:31 am
Post
by MateoLC » Fri Sep 27, 2019 2:21 am
Ilustración del menú del juego
y programación de los botones

Mateo López C
Fundamentos de progración.
-
Awaketo
- Posts: 29
- Joined: Thu Jul 18, 2019 9:29 am
Post
by Awaketo » Wed Oct 02, 2019 1:45 am
¿Qué hemos hecho?
Programar el Hub de vida.
Menù funcional
¿Qué vamos a hacer?
Reprogramar enemigos y posible alteraciòn en el mapa para poder añadir el feedback a la perdidad de vida (Juan)
Obstáculos primer nivel (Mateo)
Diseño segundo nivel (Emanuel)
¿Qué dificultades hemos tenido?
Se quiso añadir feedback a la perdida de vida del personaje principal, pero por algún motivo no cuando colisionaba con un enemigo no interactuaban, se llegó a que la única solución es reprogramar los enemigos y probablemente alterar un poco el mapa para un correcto comportamiento de estos.
Sprint 10
Inicio: 27/09/2019
Final: 03/10/2019
Tareas
Mirar el video de la semana(todos)
Diseño segundo nivel (Emanuel)
Programar FeedBack de la vida, reprogramar enemigos y alterar un poco el mapa(Juan)
Añadir obstáculos al primer nivel (Mateo)
Juan Osorio Ceballos
Estudiante de fundamentos de programación.
Gyga Tryhard
-
EliteP
- Posts: 29
- Joined: Thu Jul 18, 2019 9:31 am