Desert Space - Jump Motherfucker

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

User avatar
Awaketo
Posts: 29
Joined: Thu Jul 18, 2019 9:29 am

Re: Desert Space - Jump Motherfucker

Post by Awaketo » Sat Nov 02, 2019 11:53 pm



Presentación final del juego Desert Space.

https://github.com/EliteV1/Desert-Space-Codigos

Repositorio Juego Desert Space.
Juan Osorio Ceballos
Estudiante de fundamentos de programación. :geek:
Gyga Tryhard

User avatar
MateoLC
Posts: 11
Joined: Thu Jul 18, 2019 9:31 am

Re: Desert Space - Jump Motherfucker

Post by MateoLC » Fri Nov 15, 2019 3:48 pm

Code: Select all

public class Enemy : MonoBehaviour
{

    public float visionRadius;
    public float spppeed;

    GameObject player;

    Vector3 initialPosition;
    // Start is called before the first frame update
    void Start()
    {
        player = GameObject.FindGameObjectWithTag("Player");
        initialPosition = transform.position;
    }

    // Update is called once per frame
    void Update()
    {
        Vector3 target = initialPosition;

        float dist = Vector2.Distance(player.transform.position, transform.position);
        if (dist < visionRadius) target = player.transform.position;

        float fixedSpeed = spppeed * Time.deltaTime;
        transform.position = Vector3.MoveTowards(transform.position, target, fixedSpeed);

        Debug.DrawLine(transform.position, target, Color.green);
    }
    
}

Mateo López C 8-)
Fundamentos de progración.

Post Reply