lunes, 22 de febrero de 2021

Crear un contador de vidas y un sonido de ir perdiendo vidas

 
LOGRE PONER UN CONTADOR DE VIDAS AL DARME EL ENEMIGO A MI DOY UN GRITO DE DOLOR Y PIERDO 1 VIDA, AL PERDER 10 VIDAS SE REINICIA EL JUEGO AL PRINCIPIO.

  if (other.gameObject.CompareTag ("pomada")){

 "pomada" es el proyectil del enemigo cuando me impacta su tag se llama
 "pomada"

lo que provoca que se me resten puntos de vida y que tambien utilizo para el script de provocar el sonido.

 

 

 

 

  using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class restavida : MonoBehaviour {


        // Create public variables for player speed, and for the Text UI game objects
        public float speed;
        public Text countText;
        public Text winText;

        // Create private references to the rigidbody component on the player, and the count of pick up objects picked up so far
        private Rigidbody rb;
        private int count;/// <summary>



        // At the start of the game..
        void Start ()
        {

            rb = GetComponent<Rigidbody>();

            // Set the count to zero 
            //count = 0;////original
        count = 10;
            // Run the SetCountText function to update the UI (see below)
            SetCountText ();

            // Set the text property of our Win Text UI to an empty string, making the 'You Win' (game over message) blank
            winText.text = "";
        }


        void OnTriggerEnter(Collider other) 
        {


        if (other.gameObject.CompareTag ("pomada")){

                other.gameObject.SetActive (false);///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

                // Add one to the score variable 'count'
            //count = count + 1;//////original
            count = count - 1;

                SetCountText ();
            }
        }

        // Create a standalone function that can update the 'countText' UI and check if the required amount to win has been achieved
        void SetCountText()
        {


        // countText.text = "VIDAS: " + count.ToString ();///original
    countText.text = "VIDAS: " + count.ToString ();
            // Check if our 'count' is equal to or exceeded 12
        //if (count >= 10) ////original
        if (count <= 1) 

                //if (count >= 99) 
            {
                // Set the text value of our 'winText'
                winText.text = "TE HAN MATADO";

                //Destroy (gameObject, 1.2f); 
            Application.LoadLevel (1);


            }
        }
    }









using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class SUENAALPERDERUNAVIDA : MonoBehaviour {

        public AudioSource tickSource;

        void Start () {

            tickSource = GetComponent<AudioSource> ();



        }

        void Update () {
        }



        void OnTriggerEnter(Collider other) {
        if (other.gameObject.CompareTag ("pomada")){


                tickSource.Play ();



            }}

    }







jueves, 18 de febrero de 2021

warlike feats, "the documents" y como se hacen disparos en unity

 


 https://gamejolt.com/games/warlike_feats/588184

MI NUEVO PROYECTO CON UNITY ...ESTOY PLANTANDO EL HUERTO HABER QUE FRUTA SALE….

Argumento hazañas bélicas.

warlike feats
warlike feats, "the documents"
robar planos secretos de un arma nueva, o medicamento,
nave enterrada, pasillos , maquinas, ordenadores, cámaras de munición, científicos,
plataformas torres de vigilancia, puertas que se abren o explosionamos,

1- entrada torres de vigilancia destruir
2- patrullas a pie destruir.
3- entrar en interior edificación gigante.
4- pasillos, puertas , circulares bóvedas ,



scripts del juego tema disparos.


using UnityEngine;
using System.Collections;

public class Launcher : MonoBehaviour
{
    
    public Rigidbody projectile;
    public Rigidbody explosiveProjectile;
    public float launchspeed = 50;
    public bool useExplodingProjectiles = false;
    
    private float _LaunchDelayTime = 0.0f;
    
    public int stackSize = 60;            
    public Transform launchHole1;
    public Transform launchHole2;
    
    private Stack _Projectiles;
    private Stack _ExplosiveProjectiles;
    private Transform _myTransform;
    
    // Use this for initialization
    void Start ()
    {
        _myTransform = transform;
        _Projectiles = new Stack();
        if(useExplodingProjectiles)
        {
        _ExplosiveProjectiles = new Stack();
        }

        for(int i = 0; i <  stackSize; i++)
        {
            Rigidbody tr = Instantiate (projectile, _myTransform.position, _myTransform.rotation) as Rigidbody;
            PushProjectile(tr);

            if(useExplodingProjectiles)
            {
            Rigidbody rr = Instantiate (explosiveProjectile, _myTransform.position, _myTransform.rotation) as Rigidbody;
            PushExplosiveProjectile(rr);
            }
        }
    }
    
    // Update is called once per frame
    void Update ()
    {
        if(_Projectiles.Count > 0)
        {
            if(Time.time > _LaunchDelayTime)
        {    




                if (Input.GetButton ("Fire1")) ////ametralladora
        //    if (Input.GetButtonDown ("Fire1")) original tiro a tiro

            {
                Rigidbody tr = PopProjectile();
                tr.gameObject.SetActive(true);
                tr.transform.position = launchHole1.position;
                tr.transform.rotation = launchHole1.rotation;
                tr.velocity = transform.TransformDirection (Vector3.forward * launchspeed);
                
                tr = PopProjectile();
                tr.gameObject.SetActive(true);
                tr.transform.position = launchHole2.position;
                tr.transform.rotation = launchHole2.rotation;
                tr.velocity = transform.TransformDirection (Vector3.forward * launchspeed);
                    
                _LaunchDelayTime = Time.time + 0.5f;
            }
        }    
        }

        if(useExplodingProjectiles)
        {
        if(_ExplosiveProjectiles.Count > 0)
        {
            if(Time.time > _LaunchDelayTime)
            {    
                if (Input.GetButtonDown ("Fire2")) 
                {
                    Rigidbody tr = PopExplosiveProjectile();
                    tr.gameObject.SetActive(true);
                    tr.transform.position = launchHole1.position;
                    tr.transform.rotation = launchHole1.rotation;
                    tr.velocity = transform.TransformDirection (Vector3.forward * launchspeed);
                    
                    tr = PopExplosiveProjectile();
                    tr.gameObject.SetActive(true);
                    tr.transform.position = launchHole2.position;
                    tr.transform.rotation = launchHole2.rotation;
                    tr.velocity = transform.TransformDirection (Vector3.forward * launchspeed);
                    
                    _LaunchDelayTime = Time.time + 0.5f;
                }
            }    
        }
        }
    }
    
    public void PushProjectile(Rigidbody x)
    {
        x.gameObject.SetActive(false);
         _Projectiles.Push(x);
    }
    
    public Rigidbody PopProjectile()
    {
        return (Rigidbody)_Projectiles.Pop();
    }

    public void PushExplosiveProjectile(Rigidbody x)
    {
        x.gameObject.SetActive(false);
        _ExplosiveProjectiles.Push(x);
    }
    
    public Rigidbody PopExplosiveProjectile()
    {
        return (Rigidbody)_ExplosiveProjectiles.Pop();
    }
}

 

 

 

 

 

 

  using System;
using UnityEngine;
using UnityStandardAssets.CrossPlatformInput;

namespace UnityStandardAssets.Utility
{
    public class SimpleMouseRotator : MonoBehaviour
    {
        // A mouselook behaviour with constraints which operate relative to
        // this gameobject's initial rotation.
        // Only rotates around local X and Y.
        // Works in local coordinates, so if this object is parented
        // to another moving gameobject, its local constraints will
        // operate correctly
        // (Think: looking out the side window of a car, or a gun turret
        // on a moving spaceship with a limited angular range)
        // to have no constraints on an axis, set the rotationRange to 360 or greater.
        public Vector2 rotationRange = new Vector3(70, 70);
        public float rotationSpeed = 10;
        public float dampingTime = 0.2f;
        public bool autoZeroVerticalOnMobile = true;
        public bool autoZeroHorizontalOnMobile = false;
        public bool relative = true;
        
        
        private Vector3 m_TargetAngles;
        private Vector3 m_FollowAngles;
        private Vector3 m_FollowVelocity;
        private Quaternion m_OriginalRotation;


        private void Start()
        {
            m_OriginalRotation = transform.localRotation;
        }


        private void Update()
        {
            // we make initial calculations from the original local rotation
            transform.localRotation = m_OriginalRotation;

            // read input from mouse or mobile controls
            float inputH;
            float inputV;
            if (relative)
            {
                inputH = CrossPlatformInputManager.GetAxis("Mouse X");
                inputV = CrossPlatformInputManager.GetAxis("Mouse Y");

                // wrap values to avoid springing quickly the wrong way from positive to negative
                if (m_TargetAngles.y > 180)
                {
                    m_TargetAngles.y -= 360;
                    m_FollowAngles.y -= 360;
                }
                if (m_TargetAngles.x > 180)
                {
                    m_TargetAngles.x -= 360;
                    m_FollowAngles.x -= 360;
                }
                if (m_TargetAngles.y < -180)
                {
                    m_TargetAngles.y += 360;
                    m_FollowAngles.y += 360;
                }
                if (m_TargetAngles.x < -180)
                {
                    m_TargetAngles.x += 360;
                    m_FollowAngles.x += 360;
                }

#if MOBILE_INPUT
            // on mobile, sometimes we want input mapped directly to tilt value,
            // so it springs back automatically when the look input is released.
            if (autoZeroHorizontalOnMobile) {
                m_TargetAngles.y = Mathf.Lerp (-rotationRange.y * 0.5f, rotationRange.y * 0.5f, inputH * .5f + .5f);
            } else {
                m_TargetAngles.y += inputH * rotationSpeed;
            }
            if (autoZeroVerticalOnMobile) {
                m_TargetAngles.x = Mathf.Lerp (-rotationRange.x * 0.5f, rotationRange.x * 0.5f, inputV * .5f + .5f);
            } else {
                m_TargetAngles.x += inputV * rotationSpeed;
            }
#else
                // with mouse input, we have direct control with no springback required.
                m_TargetAngles.y += inputH*rotationSpeed;
                m_TargetAngles.x += inputV*rotationSpeed;
#endif

                // clamp values to allowed range
                m_TargetAngles.y = Mathf.Clamp(m_TargetAngles.y, -rotationRange.y*0.5f, rotationRange.y*0.5f);
                m_TargetAngles.x = Mathf.Clamp(m_TargetAngles.x, -rotationRange.x*0.5f, rotationRange.x*0.5f);
            }
            else
            {
                inputH = Input.mousePosition.x;
                inputV = Input.mousePosition.y;

                // set values to allowed range
                m_TargetAngles.y = Mathf.Lerp(-rotationRange.y*0.5f, rotationRange.y*0.5f, inputH/Screen.width);
                m_TargetAngles.x = Mathf.Lerp(-rotationRange.x*0.5f, rotationRange.x*0.5f, inputV/Screen.height);
            }

            // smoothly interpolate current values to target angles
            m_FollowAngles = Vector3.SmoothDamp(m_FollowAngles, m_TargetAngles, ref m_FollowVelocity, dampingTime);

            // update the actual gameobject's rotation
            transform.localRotation = m_OriginalRotation*Quaternion.Euler(-m_FollowAngles.x, m_FollowAngles.y, 0);
        }
    }
}

 

 

 

 

  using UnityEngine;
using System.Collections;

public class Launcher2 : MonoBehaviour
{

    public Rigidbody projectile;
    public Rigidbody explosiveProjectile;
    public float launchspeed = 50;
    public bool useExplodingProjectiles = false;

    private float _LaunchDelayTime = 0.0f;

    public int stackSize = 60;            
    public Transform launchHole1;
    public Transform launchHole2;

    private Stack _Projectiles;
    private Stack _ExplosiveProjectiles;
    private Transform _myTransform;

    // Use this for initialization
    void Start ()
    {
        _myTransform = transform;
        _Projectiles = new Stack();
        if(useExplodingProjectiles)
        {
            _ExplosiveProjectiles = new Stack();
        }

        for(int i = 0; i <  stackSize; i++)
        {
            Rigidbody tr = Instantiate (projectile, _myTransform.position, _myTransform.rotation) as Rigidbody;
            PushProjectile(tr);

            if(useExplodingProjectiles)
            {
                Rigidbody rr = Instantiate (explosiveProjectile, _myTransform.position, _myTransform.rotation) as Rigidbody;
                PushExplosiveProjectile(rr);
            }
        }
    }

    // Update is called once per frame
    void Update ()
    {
        if(_Projectiles.Count > 0)
        {
            if(Time.time > _LaunchDelayTime)
            {    






                //if (Input.GetKeyDown(KeyCode.Space))
                if (Input.GetKey (KeyCode.M)) /////////////////imbentadooooooooooooooooooooooooooooooooooooo
                //if (Input.GetButton ("Fire1")) ////ametralladora
                    //    if (Input.GetButtonDown ("Fire1")) original tiro a tiro




                {
                    Rigidbody tr = PopProjectile();
                    tr.gameObject.SetActive(true);
                    tr.transform.position = launchHole1.position;
                    tr.transform.rotation = launchHole1.rotation;
                    tr.velocity = transform.TransformDirection (Vector3.forward * launchspeed);

                    tr = PopProjectile();
                    tr.gameObject.SetActive(true);
                    tr.transform.position = launchHole2.position;
                    tr.transform.rotation = launchHole2.rotation;
                    tr.velocity = transform.TransformDirection (Vector3.forward * launchspeed);

                    _LaunchDelayTime = Time.time + 0.5f;
                }
            }    
        }

        if(useExplodingProjectiles)
        {
            if(_ExplosiveProjectiles.Count > 0)
            {
                if(Time.time > _LaunchDelayTime)
                {    
                    if (Input.GetButtonDown ("Fire2")) 
                    {
                        Rigidbody tr = PopExplosiveProjectile();
                        tr.gameObject.SetActive(true);
                        tr.transform.position = launchHole1.position;
                        tr.transform.rotation = launchHole1.rotation;
                        tr.velocity = transform.TransformDirection (Vector3.forward * launchspeed);

                        tr = PopExplosiveProjectile();
                        tr.gameObject.SetActive(true);
                        tr.transform.position = launchHole2.position;
                        tr.transform.rotation = launchHole2.rotation;
                        tr.velocity = transform.TransformDirection (Vector3.forward * launchspeed);

                        _LaunchDelayTime = Time.time + 0.5f;
                    }
                }    
            }
        }
    }

    public void PushProjectile(Rigidbody x)
    {
        x.gameObject.SetActive(false);
        _Projectiles.Push(x);
    }

    public Rigidbody PopProjectile()
    {
        return (Rigidbody)_Projectiles.Pop();
    }

    public void PushExplosiveProjectile(Rigidbody x)
    {
        x.gameObject.SetActive(false);
        _ExplosiveProjectiles.Push(x);
    }

    public Rigidbody PopExplosiveProjectile()
    {
        return (Rigidbody)_ExplosiveProjectiles.Pop();
    }
}

 

domingo, 31 de enero de 2021

play.unity.com/mg/other/medal-of-honor-tribute

https://play.unity.com/mg/other/medal-of-honor-tribute-https-gamejolt-com-games-medal_of_honor_tribute-581068 


Diseño grafico, imaginacion con lineas

https://videojuegosenlineaasaco4.blogspot.com/p/diseno-grafico-imaginacion-con-lineas.html 

Dibujando manos

👇👇👇👇👇👇👇👇👇👇👇👇👇👇👇👇👇👇👇👇👇👇

https://videojuegosenlineaasaco4.blogspot.com/p/dibujando-manos.html 

👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍

1..¿Como e echo los Créditos del videojuego?

 

1..¿Como e echo los Créditos del videojuego?

En el video veréis los pasos.


 

Recomiendo , bajéis el TextMesh Pro.

Es súper fácil de la forma que lo ago yo.

Solo tenéis que ponerle un Rigidbody al TextMesh Pro.

Ponerle una velocidad de gravedad que no sea ni muy rápida ni muy lenta para poder leer los créditos y para que la memoria del juego no pare el juego por sobrecarga de esta podéis poner este script y el tiempo que queráis que se vean los créditos para luego borrarlos si queréis.



using System;
using UnityEngine;

namespace UnityStandardAssets.Utility
{
public class TimedObjectDestructor : MonoBehaviour
{
[SerializeField] private float m_TimeOut = 1.0f;
[SerializeField] private bool m_DetachChildren = false;


private void Awake()
{
Invoke("DestroyNow", m_TimeOut);
}


private void DestroyNow()
{
if (m_DetachChildren)
{
transform.DetachChildren();
}
DestroyObject(gameObject);
}
}
}






2...¿Y que son los Créditos?

2...Al principio o al final de las obras audiovisuales, los créditos citan miembros del reparto y el equipo implicado en la producción. Normalmente consisten en una lista de nombres y funciones a pequeño tipo, que pasan rápidamente página a página o bien se deslizan sobre el fondo o una pantalla negra. En esta segunda opción, los créditos se pueden deslizar de derecha a izquierda, opción común en el Reino Unido y en la televisión iberoamericana; o de abajo arriba, opción habitual en la televisión y el cine estadounidense. En inglés también se usa el término credit roll (literalmente ‘rollo de crédito’), que procede de la época pionera del cine, cuando los nombres se imprimían físicamente en un rollo de papel que se hacía pasar por delante de la cámara. Ocasionalmente se agregan escenas o voces de los personajes tras los créditos o durante los mismos, a modo de epílogo, o se intercalan bloopers entre ellos.

El uso de créditos de cierre en las películas para mencionar el reparto y equipo de producción completo no se estableció firmemente en el cine estadounidense hasta los años 1970. Hasta esa década, la mayoría de las películas se proyectaban sin créditos de cierre; solían tener únicamente créditos de apertura, que incluyen únicamente el reparto y equipo principales.[cita requerida]

Dos de las primeras grandes producciones que incluyeron créditos de cierre extensivos fueron los blockbusters La vuelta al mundo en ochenta días (1956) y West Side Story (1961). La vuelta al mundo en ochenta días tuvo una de las secuencias de créditos finales más larga y elaborada de la historia del cine: dura unos siete minutos y proporciona una recapitulación animada de la historia de la película, identificando a los actores en el orden en que aparecen en la trama.

Superman: la película también tiene una secuencia muy larga para sus títulos de cierre, de casi ocho minutos de duración, que fue la más larga de la historia en el momento del lanzamiento de la película.2

En la mayoría de las emisoras de televisión se cortan los créditos de cierre de las películas y programas de televisión que se emiten, pues consumen un importante tiempo de emisión y separan el contenido del tiempo publicitario, haciendo menos efectiva esa publicidad. Por ese mismo motivo, la mayoría de los programas de televisión no listan su equipo completo, salvo en ediciones en video o DVD.