miércoles, 30 de junio de 2021

Violencia en videojuegos.;

Violencia en videojuegos.

Nuevo adelanto, empiezo a hacer personajes como el señor trajeado fumando en el metro y la mujer lijera de ideas, y mucha violencia, sangre en el suelo sangre en el asiento, cabezas volando, y cuerpos mutilados temblando por los nervios segmentados del cuello, todo muy desagradable, recuerdo a los lectores que ahora mis videojuegos se centraran en mayores de 18 años no aptos para gente sensible tampoco.

 




domingo, 27 de junio de 2021

Arranco las cabezas de un zarpazo con el script de ActivateTrigger,;GIMP 2.10.12;Trail Renderer;Unity;

 


Bien sigo con mi videojuego comentando últimos de talles del trabajo.

 


Ahora explicare como arranco las cabezas de un zarpazo con el script de ActivateTrigger, pondré el script para el que lo quiera copiar, creo que ya lo e puesto mas de 10 veces a lo largo de mi blog, pues otra vez porque es indispensable.

  using System;
using UnityEngine;
using Object = UnityEngine.Object;

namespace UnityStandardAssets.Utility
{
    public class ActivateTrigger : MonoBehaviour
    {
        // A multi-purpose script which causes an action to occur when
        // a trigger collider is entered.
        public enum Mode
        {
            Trigger = 0,    // Just broadcast the action on to the target
            Replace = 1,    // replace target with source
            Activate = 2,   // Activate the target GameObject
            Enable = 3,     // Enable a component
            Animate = 4,    // Start animation on target
            Deactivate = 5  // Decativate target GameObject
        }

        public Mode action = Mode.Activate;         // The action to accomplish
        public Object target;                       // The game object to affect. If none, the trigger work on this game object
        public GameObject source;
        public int triggerCount = 1;
        public bool repeatTrigger = false;


        private void DoActivateTrigger()
        {
            triggerCount--;

            if (triggerCount == 0 || repeatTrigger)
            {
                Object currentTarget = target ?? gameObject;
                Behaviour targetBehaviour = currentTarget as Behaviour;
                GameObject targetGameObject = currentTarget as GameObject;
                if (targetBehaviour != null)
                {
                    targetGameObject = targetBehaviour.gameObject;
                }

                switch (action)
                {
                    case Mode.Trigger:
                        if (targetGameObject != null)
                        {
                            targetGameObject.BroadcastMessage("DoActivateTrigger");
                        }
                        break;
                    case Mode.Replace:
                        if (source != null)
                        {
                            if (targetGameObject != null)
                            {
                                Instantiate(source, targetGameObject.transform.position,
                                            targetGameObject.transform.rotation);
                                DestroyObject(targetGameObject);
                            }
                        }
                        break;
                    case Mode.Activate:
                        if (targetGameObject != null)
                        {
                            targetGameObject.SetActive(true);
                        }
                        break;
                    case Mode.Enable:
                        if (targetBehaviour != null)
                        {
                            targetBehaviour.enabled = true;
                        }
                        break;
                    case Mode.Animate:
                        if (targetGameObject != null)
                        {
                            targetGameObject.GetComponent<Animation>().Play();
                        }
                        break;
                    case Mode.Deactivate:
                        if (targetGameObject != null)
                        {
                            targetGameObject.SetActive(false);
                        }
                        break;
                }
            }
        }


        private void OnTriggerEnter(Collider other)
        {
            DoActivateTrigger();
        }
    }
}

Detalles de la sangre en el suelo, mismo script ActivateTrigger,

Detalles de la salpicadura de sangre en el asiento en el respaldo,mismo script ActivateTrigger, esta vez e utilizado el programa gratuito GIMP 2.10.12 para pintar gráficos.

(poner imagen)


 








Abriendo gimp crear nuevo archivo con transparencia, usar la herramienta de aerografo para pintar unas salpicaduras de sangre y para que se vea la transparencia muy importante exportar en formato “PNG” este detalle es muy importante,

(poner imágenes)

luego pasar ese archivo a Unity y hacer un plano ponerle esa textura, hacer un prefabricado de esta y poner en el respaldo del asiento un plano sin la textura.

(poner imágenes)

Para la sangre en el suelo e puesto unos planos que hacen el cambio de charcos de sangre también utilizando ActivateTrigger, y para que no se vean les e quitado el Mesh, en las imágenes podéis ver señalado en círculos blancos los detalles mas importantes que intento explicar , creo que cuantas mas imágenes ponga mejor podrá entenderse lo que me gusta explicar.


(poner imagen)

La sangre en el suelo la e echo con los recursos gratuitos que ofrece Unity

Standard Assets Environment Water desde la versión 2018,2,1f1 de Unity que al final es la que estoy utilizando para hacer el videojuego ya que estoy mas echo a esta versión.

Otros detalles son utilizar desde Unity el efecto Trail Renderer, se lo aplico a unas esferas como hijos del cuerpo decapitado y de la cabeza decapitada para que agan un efecto de salpicadura.

 



(poner imagen)


Y los sonidos descargados desde http://www.sonidosmp3gratis.com/


jueves, 24 de junio de 2021

Unity 2020.3.12f1 ;

 

Bueno con mi pc a surgido un imprevisto, no me recarga la batería del portátil y trasteando e perdido días para seguir con mi videojuego, y encima no lo e resuelto, aunque nunca uso la batería pues siempre tengo conectado el

portátil a la corriente eléctrica, en fin ni reinstalando el windowos10 lo e conseguido, bueno tarda unos segundos mas en encenderse el equipo pero ya lo dejo así.


E aprovechado para descargar una versión mas reciente de Unity la nuevo Unity 2020.3.12f1

yo vengo usando la versión 2018.2.1f1



Y de momento cuelgo este video para ver unas diferencias del los dos unitys...en internet busque si hay una mejor que otra de momento e leído esto “Si quieres mantener toda tu producción en una versión específica de Unity para garantizar una estabilidad óptima, te recomendamos usar Unity 2018.4 LTS. “


La verdad hay diferencias si se cambia la versión, tienes que empezar desde cero con cosas que ya se sabían de versiones mas antiguas…..pero es necesario actualizarse y ver las novedades y adaptarse, si no llegaría un punto que lo que hacemos no serviría de lo antiguo que seria, ya se sabe, este mundo de los pc , informática, programas , hardware ….tiene constantes cambios a velocidades alucinantes

domingo, 20 de junio de 2021

COMO ESTOY HACIENDO UN VIDEOJUEGO EN UNITY Y BLENDER; MAS DE HOMBRE LOBO;

 


Detalles de mi videojuego con mi voz en of.

MagicMirror,; el recurso es free gratuito,De hombre lobo.;

 


Y mas detalles amedida que voy trabajando el videojuego, pongo otro video de youtube, en este video muestro y explicare lo mejor que pueda como e asignado el movimiento por teclas del personaje, me a resultado muy sencillo de hacer aprovechando los recursos de mis anteriores videojuegos inspirados en la ll guerra mundial.

 

 https://gamejolt.com/games/THE_END_WARLIKE_FEATS/609220

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

public class CONTROLREPARTIDOR : MonoBehaviour {

    public Animator Anim;
    public float WalkSpeed;

    void Update () {

        if (Input.GetKey (KeyCode.E)) {
            Anim.SetBool ("CORRER", true);
            transform.Translate (Vector3.forward * WalkSpeed * Time.deltaTime);
        } else {
            Anim.SetBool ("CORRER", false);

            if (Input.GetKey (KeyCode.W)) {
                Anim.SetBool ("ANDA", true);
                transform.Translate (Vector3.forward * WalkSpeed * Time.deltaTime);
            } else {
                Anim.SetBool ("ANDA", false);

                if (Input.GetKey (KeyCode.S)) {
                    Anim.SetBool ("ATRAS", true);
                    transform.Translate (Vector3.forward * WalkSpeed * Time.deltaTime);
                } else {
                    Anim.SetBool ("ATRAS", false);

                    if (Input.GetKey (KeyCode.A)) {

                        Anim.SetBool ("CORRER", true);
                        transform.Translate (Vector3.forward * WalkSpeed * Time.deltaTime);
                    } else {
                        Anim.SetBool ("CORRER", false);

                        if (Input.GetKey (KeyCode.P)) {

                            Anim.SetBool ("BOMBA", true);
                            transform.Translate (Vector3.forward * WalkSpeed * Time.deltaTime);
                        } else {
                            Anim.SetBool ("BOMBA", false);


                            if (Input.GetKey (KeyCode.O)) {

                                Anim.SetBool ("BOMBA", true);
                                transform.Translate (Vector3.forward * WalkSpeed * Time.deltaTime);
                            } else {
                                Anim.SetBool ("BOMBA", false);

                                if (Input.GetKey (KeyCode.D)) {

                                    Anim.SetBool ("CORRER", true);
                                    transform.Translate (Vector3.forward * WalkSpeed * Time.deltaTime);
                                } else {
                                    Anim.SetBool ("CORRER", false);


                                            if (Input.GetButton ("Fire1")) {
                                            
                                            Anim.SetBool ("DISPARANDO", true);
                                            transform.Translate (Vector3.forward * WalkSpeed * Time.deltaTime);
                                        } else {
                                            Anim.SetBool ("DISPARANDO", false);


                                                if (Input.GetKey (KeyCode.M)) {
                                                Anim.SetBool ("LANZAR", true);
                                                transform.Translate (Vector3.forward * WalkSpeed * Time.deltaTime);
                                            } else {
                                                Anim.SetBool ("LANZAR", false);



                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }

}






También desde el Asset store e descargado unos recursos de reflejos en espejos para que pueda simular lo mejor que sepa los reflejos de los cristales de las puertas y ventanas del entorno de un tren de metro subterráneo de cualquier ciudad.

MagicMirror, el recurso es free gratuito, y se consigue con facilidad hacer reflejos de superficies planas, solo hay que arrastrar los gráficos y el script que viene en sus carpetas.





Detalles de programación para provocar el movimiento y el sonido de un rugido cuando da el personaje un zarpazo….


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

public class suenaalapretarbotonratonizquierdo : MonoBehaviour {



        private AudioSource sonido;
        public AudioClip elcamion;
        // Use this for initialization
        void Start () {
            sonido = GetComponent<AudioSource>();    
        }

        // Update is called once per frame
        void Update ()
        {

    
    

        //if (Input.GetButton ("Fire1")) {//////al soltar suena AL SOLTAR SUENA
        if (Input.GetButtonDown("Fire1")) {///////AL APRETAR AL INSTANTE SUENA


    //if( Input.GetKeyDown( KeyCode.E ) ) {////////////// sonido al apretar

                //if (Input.GetKey (KeyCode.S)) {
                sonido.clip = elcamion;
                sonido.Play ();

                if (Input.GetKey (KeyCode.S)) {
                    sonido.clip = elcamion;
                    sonido.Play ();
                    if (Input.GetKey (KeyCode.A)) {
                        sonido.clip = elcamion;
                        sonido.Play ();
                        if (Input.GetKey (KeyCode.D)) {




                            //if (Input.GetKeyDown.W(KeyCode.W)){
                            sonido.clip = elcamion;
                            sonido.Play ();
                        }
                    }
                }
            }
        }
    }

Tareas que e de realizar, trabajar los gráficos del vagon de metro, trabajar los personajes, que están sentados en el vagón del metro, crear mas animaciones, en este videojuego me resulta mas faciles hacer yo las animaciones con blender de los personajes que están sentados, y es sencillo poner el nombre de cada animación en particular y necesario para no confundirlas con otras ya echas,

También exportar esos personajes retocados con blender, pintados y animados en formato fbx para ser utilizados por Unity.

 https://unity.com/

 

 https://www.blender.org/

 

Los personajes no están modelados desde cero a partir de blender, supongo podría con muchísimo trabajo hacerlos y ponerles el esqueleto y conseguir un resultado aceptable, pero para eso utilizo el programa gratuito “ makehuman-community”, luego lo manipulo con blender.

podéis descargar desde internet.“ makehuman-community”

(poner enlace)

 http://www.makehumancommunity.org/content/downloads.html

And more details as I work on the video game, I put another YouTube video, in this video I will show and explain as best I can how I assigned the movement by character keys, it has been very easy for me to do taking advantage of the resources of my previous video games Inspired by World War II.


(put link) (put script) (explain something)


Also from the Asset store I have downloaded some resources of reflections in mirrors so that you can simulate the best you know the reflections of the glass of the doors and windows of the surroundings of an underground subway train in any city.

MagicMirror, the resource is free, and you can easily make reflections of flat surfaces, you just have to drag the graphics and the script that comes in their folders.


(put link or capture)


Programming details to provoke the movement and the sound of a roar when the character gives a claw….

. (put script and script detail)


Tasks that I must perform, work on the graphics of the subway car, work on the characters, who are sitting in the subway car, create more animations, in this video game it is easier for me to make the animations with blender of the characters that are seated , and it is easy to put the name of each animation in particular and necessary so as not to confuse them with others already made,

Also export those characters retouched with blender, painted and animated in fbx format to be used by Unity.

The characters are not modeled from scratch from blender, I suppose I could with a lot of work make them and put the skeleton on them and achieve an acceptable result, but for that I use the free program "makehuman-community", then I manipulate it with blender.

you can download from the internet. "makehuman-community"

(put link)

 

martes, 15 de junio de 2021

Videojuego terror De hombre lobo.;y animaciones;

 

Sigo trabajando el videojuego, este me parece una especie de cómic interactivo o película interactiva, yo soy una persona muy cine fila y a medida que voy ampliando y trabajando el videojuego veo que me salen…...la cosa esta de forma intuitiva de cambios de cámaras y de planos….cuanto mas me pongo mas me gusta Unity.



De hombre lobo.

Idea de videojuego de hombre lobo arrancando cabezas a tortazo limpio,,,seria para mayores de 18 años y gore sangre y animación en el vagón de un metro se le va la olla a un pavo se con vierte en lobo arranca cabezas y sale huyendo.

Nuevo proyecto de trabajo que estoy desarrollando y que procurare no alargarlo mucho…..espero no me lo plagien...de todas formas si me gusta igual estoy 2 o 3 meses trabajándolo….bueno hay lo dejo para que se te aga la boca agua esperando mi nuevo videojuego de terror de mayores de 18 años tope gore tope agresivo tope desagradable…...y adelanto un video del tema….que publico dentro de unos minutitos.....



Estoy practicando animar yo los personajes…..en un principio quería descargar animaciones ya echas y asignarlas, pero por increíble que me parezca ,creo me va a dar menos trabajo hacerlas yo, y aplicarlas al videojuego,,,,cosa que me enorgullece por supuesto.



 

Hoy unas pruebas de cambios de escenas para las transformaciones y una prueba de sonido incluida.

También unos scripts para los cambios de escenas….


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;/// <summary>
public class cambiodeescenadehombrelobotransformacionportiempo : MonoBehaviour {



        public Text contador1;
        public Text fin1;
        private float tiempo = 4f;
        // Use this for initialization
        void Start () {
            contador1.text = " " + tiempo;
            fin1.enabled = false;




        }

        // Update is called once per frame
        void Update ()
        {
            tiempo -= Time.deltaTime;
            contador1.text = " " + tiempo.ToString ("f0");
            if (tiempo <= 0) {
                contador1.text = "0";
                fin1.enabled = true;



                {




                    Destroy (gameObject, 0.0f); 

                    {

                        //Application.LoadLevel (1); ESTE ES EL ORIGINALLLLLLL

                        Application.LoadLevel (1);


                    }
                }
            }
        }

    }
-------------------------------------------------------------------------

-------------------------------------------------------------------------


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;/// <summary>
public class cambiodeescenadehombrelobosetransformaportiempoescena2 : MonoBehaviour {



        public Text contador1;
        public Text fin1;
        private float tiempo = 4f;
        // Use this for initialization
        void Start () {
            contador1.text = " " + tiempo;
            fin1.enabled = false;




        }

        // Update is called once per frame
        void Update ()
        {
            tiempo -= Time.deltaTime;
            contador1.text = " " + tiempo.ToString ("f0");
            if (tiempo <= 0) {
                contador1.text = "0";
                fin1.enabled = true;



                {




                    Destroy (gameObject, 0.0f); 

                    {

                        //Application.LoadLevel (1); ESTE ES EL ORIGINALLLLLLL

                        Application.LoadLevel (2);


                    }
                }
            }
        }

    }
----------------------------------------------------------------------------

----------------------------------------------------------------------------


using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;/// <summary>
public class escena3 : MonoBehaviour {


        public Text contador1;
        public Text fin1;
        private float tiempo = 4f;
        // Use this for initialization
        void Start () {
            contador1.text = " " + tiempo;
            fin1.enabled = false;




        }

        // Update is called once per frame
        void Update ()
        {
            tiempo -= Time.deltaTime;
            contador1.text = " " + tiempo.ToString ("f0");
            if (tiempo <= 0) {
                contador1.text = "0";
                fin1.enabled = true;



                {




                    Destroy (gameObject, 0.0f); 

                    {

                        //Application.LoadLevel (1); ESTE ES EL ORIGINALLLLLLL

                        Application.LoadLevel (3);


                    }
                }
            }
        }

    }


O F E R T A ;

 ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

 https://itch.io/s/51430/itchio-summer-sale-2021

🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅

jueves, 10 de junio de 2021

Nuevo proyecto...videojuegos para adultos de mas de 18 años;

 Lo que reflejo en este videojuego o doy a mostrar, es que el ser humano no tiene escapatoria, nuestro destino, es que un día dejaremos de existir, por eso la temática es de mayores de 18 años, quizás no sea exactamente un videojuego, es mas bien un historia que quiero mostrar, un pensamiento sobre la vida de todos nosotros, perdón de todos no, huffffff, apañados estaríamos ….por suerte la inmensa mayoría de nosotros moriremos por vejez y no por accidentes, desgracias del mundo o llevar mala vida………...por eso elige tu muerte la que mas te guste, almenos aquí la podemos elegir.

 What I reflect in this video game or give to show, is that the human being has no escape, our destiny, is that one day we will cease to exist, that is why the theme is over 18 years old, perhaps it is not exactly a video game, it is Rather, a story that I want to show, a thought about the lives of all of us, sorry for all of us, huffffff, we would be fine ... luckily the vast majority of us will die of old age and not from accidents, misfortunes in the world or leading a bad life ……… ... that's why choose your death the one you like the most, at least here we can choose it.


Mayores 18 años


Videojuego de temática macabra y solo para adultos un cambio súper radical para ver la reacción en la web, haber lo que llama la atención.......voy hacer un poquito de ...como diría...estudio de mercado.


temas....

Juego de azar....nos jugamos el destino de un personaje al nacer.....por azar lanzando unos dados aremos que su destino sea su tipo de muerte....


EL PROTAGONISTA DEL VIDEOJUEGO NO ES UN PERSONAJE DE CARNE Y HUESO ES UNA IDEA...LE LLAMAREMOS POSIBLE FUTURO DE CUALQUIERA Y LA REALIDAD SUPERA LA FICCIÓN RECUERDO QUE ES UN JUEGO PARA ADULTOS XXX GORE NO APTO EN ABSOLUTO PARA NIÑOS NI PERSONAS INMADURAS....MUY DESAGRADABLE COMO LA VIDA MISMA...(AUNQUE ESTA ES ORRIPILANTEMENTE PEOR)


COMO EL CONCEPTO ME PARECE ALGO COMPLICADO O CONFUSO....ARE EL TÍPICO PERSONAJE DEL SEÑOR MUERTE CON LA GUADAÑA EL ESQUELETO ETC ..ETC ...ETC....ESTE LANZARA UNOS DADOS O ALGÚN MECANISMO QUE SAQUE A DEDUCIR UNO DE ESTOS 10 CONCEPTOS.....CADA UNO CON SUS IMÁGENES DESAGRADABLES.......QUIZÁS PONGA SIMPLE FOTOGRAFIÁS QUE ENCUENTRE POR INTERNET...Y SOLO ANIME AL ESQUELETO Y AL NIÑO PEQUEÑITO...



YA SE EL NIÑO LO HACEMOS CAMINAR Y AL DE LA GUADAÑA VA DETRÁS DE EL HAY 10 PUERTAS CUANDO ENTRA SALEN LAS IMÁGENES DE SU MUERTE....EL DE LA GUADAÑA LE VA SUSURRANDO ELIGE TU TU DESTINO DE MUERTE.



1...por vejez se le vera morir de viejo.

2...por drogadiccion. Muerte de sobredosis

3 ....por enfermedades venéreas

4.... por ser atracado robado y asesinado

5.....por silla eléctrica al ser atrapado por asesinato por la ley ejecutado.

6.....por enfermedad por tabaco y fumar.

7....por un accidente muerto atropellado.

8.....por un accidente muerto quemado.

9...por accidente ataque cardíaco.

10.....por accidente se mata en una moto.

todo esto con gráficos sangrientos y desagradables,,,,traducido escritos en español e ingles.

Abra que hacer 10 o 12 niveles cada uno enlazado al azar de lanzar dados o alguna cosa que provoque el cambio de escena.

Atencion este proyecto esta super verde, voy trabajando sobre la tematica....pero ya veremos que resultado final dare a todo el proyecto.........esta seccion esta en obras!!!!!!!!! 



  • The gates of death,
  • las puertas de la muerte,
  • they say that when one door closes another opens,
  • dicen que cuando se cierra una puerta otra se abre,
  • New project ... video games for adults over 18 years old;
  • Over 18 years
  • A macabre themed video game for adults only, a super radical change to see the reaction on the web, to have what draws attention ....... I'm going to do a little bit of ... as I would say ... market research.
  • topics....
  • A game of chance .... we play the destiny of a character at birth ..... by chance throwing some dice we are making his destiny be his type of death ....
  • THE PROTAGONIST OF THE VIDEO GAME IS NOT A CHARACTER OF MEAT AND BONE IT IS AN IDEA ... WE WILL CALL HIM A POSSIBLE FUTURE OF ANYONE AND THE REALITY EXCEEDS THE FICTION I REMEMBER THAT IT IS A GAME FOR ADULTS XXX GORE NOT SUITABLE IN ABSOLUTE FOR CHILDREN OR IMMATURE PEOPLE .. ... VERY UNPLEASANT LIKE LIFE ITSELF ... (EVEN THOUGH THIS IS BEAUTIFULLY WORSE)
  • AS THE CONCEPT SEEMS TO ME SOMETHING COMPLICATED OR CONFUSED .... ARE THE TYPICAL CHARACTER OF THE LORD DEATH WITH THE SCYTHE THE SKELETON ETC ..ETC ... ETC .... THIS WILL THROW A SOME DICE OR SOME MECHANISM THAT TAKES OUT ONE OF THESE 10 CONCEPTS ..... EACH ONE WITH HIS UNPLEASANT IMAGES ....... MAYBE PUT SIMPLE PHOTOGRAPHS THAT I FIND ON THE INTERNET ... AND JUST ENCOURAGE THE SKELETON AND THE LITTLE CHILD ...
  • WE ALREADY MAKE THE CHILD WALK AND THE ONE WITH THE SCYTHE GOES BEHIND HIM. THERE ARE 10 DOORS WHEN THE IMAGES OF HIS DEATH COME OUT ...
  • 1 ... by old age you will see him die of old age.
  • 2 ... for drug addiction. Death from overdose
  • 3 .... due to venereal diseases
  • 4 .... for being mugged, robbed and murdered
  • 5 ..... by electric chair when caught for murder by law executed.
  • 6 ..... due to illness from tobacco and smoking.
  • 7 .... due to an accident killed by a car.
  • 8 ..... by a burned dead accident.
  • 9 ... by accident heart attack.
  • 10 ..... he accidentally kills himself on a motorcycle.
  • all this with bloody and disgusting graphics ,,,, translated written in Spanish and English.
  • Open to do 10 or 12 levels each linked randomly to throw dice or something that causes the scene change.
  • Attention, this project is super green, I am working on the theme .... but we will see what final result I will give to the entire project ......... this section is under construction !!!!!!!!!







jueves, 3 de junio de 2021

Como he hecho; el videojuego; Bombadron20;

 video tutorial

https://youtu.be/lMTKzf17kvs Bombadron20.

https://videojuegosenlineaasaco4.blogspot.com/p/juegadirectamente-bombadron20.html 

Boy a explicar como he hecho el videojuego Bombadron20.

El tema idea del videojuego es muy sencillo, un avión dron lanza unas bombas a unos camiones y al destruir cierta cantidad de ellos sale pantallazo de Misión complica, has ganado el videojuego en este caso al acumular mas de 20 camiones destruidos.

Necesitamos dos escenas la primera donde se desarrolla la accion del videojuego la e llamado ESCENA 1 .

Y la segunda donde sale el pantallazo con las letras que forman la palabra MISIÓN CUMPLIDA!!!!.

La e llamado Scenes/SampleScene.


E buscado por internet imágenes de satélite de poblaciones para hacer el fondo del videojuego donde circularan los camiones, los camiones son simples cubos con forma rectangular, las bombas que lanzo simples cylinder y el dron no se ve solo e puesto una cámara y desde esta e puesto como hijo un par de cubos que les e dado forma de cruz para hacer una mira telescópica.


El resto se resuelve mediante los scripts en C# y ciertos detalles con los gameobjects.

Intentare explicarme lo mejor que sepa y por partes.


Los gameobjects que tenemos en el videojuego son

1- el terreno donde esta la imagen de satélite de una ciudad---detalles de como esta echa...es un simple cubo, no un terreno, es un cubo que le dado forma de tabla de una mesa, tiene un box colider sin el trigger activado y otro idéntico pero con el trigger si activado, el motivo, necesidades de ciertas funciones del videojuego en este caso sumar puntos, contiene el siguiente escript…en C#.

 

 

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

public class SUMA21PASANIVELFINALPOINT : 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 ()
{


// Assign the Rigidbody component to our private rb variable
rb = GetComponent<Rigidbody>();

// Set the count to zero
count = 0;

// 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 ("balaamericano"))



{
// Make the other game object (the pick up) inactive, to make it disappear
other.gameObject.SetActive (false);///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

// Add one to the score variable 'count'
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 = "POINT: " + count.ToString ();
// Check if our 'count' is equal to or exceeded 12
if (count >= 20)
// if (count >= 31) original
//if (count >= 99)
{
// Set the text value of our 'winText'
winText.text = "JUEGO COMPLETADO";

// Destroy (gameObject, 1.2f);

/////Application.LoadLevel (5);/////ORIGINALLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL
Application.LoadLevel (1);
}
}
}


2---Luego tenemos al camión que tiene unos scripts para darle movimientos continuos y unos scripts para ser destruido y para crear una explosión y a su vez soltar un nuevo gameobject nombrado con un tac que hace la suma de puntuación al tocar este, el terreno.

Scripts del camión .

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

public class mueberosalento : MonoBehaviour {

// Use this for initialization
void Start () {

}




// Update is called once per frame
void Update () {

transform.position += transform.forward * 4f * Time.deltaTime; }


}

-----------------------------------------------------------------------------------------------------------------

-------------------------------------------------------------------------------------------------------------

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

public class cuborosadalavuelta : MonoBehaviour {

// Use this for initialization
void Start () {

}




// Update is called once per frame
void Update () {

//transform.position += transform.forward * 10.2f * Time.deltaTime; }

}


void OnTriggerEnter(Collider other) {
//if (other.gameObject.CompareTag ("avismo")){
//if (other.gameObject.CompareTag ("ogri2")){
if (other.gameObject.CompareTag ("datelavuelta")){



transform.position -= transform.forward * 1777.2f * Time.deltaTime; }



}
}


3-- Tenemos también unos cubos a donde se dirigen los camiones nombrados con el tac “datelabuelta”. .Hacen que con el script que tiene el camión aprezcaa de nuevo desde el otro lado del terreno una y otra vez continuamente.


4—Las bombas que lanza el dron, son simples cilindros a los que e colocado una cámara de forma que en una esquina de la pantalla se ve el recorrido de la bomba asta llegar al suelo, se activaba cada vez que soltamos una nueva….para no cargar la memoria estas tienen un script con un tac que hace se borre del videojuego, si no acabaría congelándose en pantalla el videojuego se pararía y saldría humo de todos los orificios del pc, (estoy exagerando ). tienen este script…

 

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

public class destruyeportacbalaamericana : MonoBehaviour {




//public AudioSource tickSource;


void Start () {

//tickSource = GetComponent<AudioSource> ();



}

void Update () {
}

void OnTriggerEnter(Collider other) {
//if (other.gameObject.CompareTag ("avismo")){
//if (other.gameObject.CompareTag ("ogri2")){
if (other.gameObject.CompareTag ("balaamericano")){
//transform.Rotate (new Vector3 (0 * Time.deltaTime, 91, 90), Space.Self);

//tickSource.Play ();
Destroy (gameObject, 0.0f);


}}

}


---------------------------------------------------------------------------------------------------------------------

----------------------------------------------------------------------------------------------------------------------

El suelo donde tocan tiene este tac ...”balaamericano”.


Tenemos también el script que provoca el cambio de escena al haber sumado mas de 20 puntos…..

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

public class SUMA21PASANIVELFINALPOINT : 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 ()
{


// Assign the Rigidbody component to our private rb variable
rb = GetComponent<Rigidbody>();

// Set the count to zero
count = 0;

// 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 ("balaamericano"))



{
// Make the other game object (the pick up) inactive, to make it disappear
other.gameObject.SetActive (false);///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

// Add one to the score variable 'count'
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 = "POINT: " + count.ToString ();
// Check if our 'count' is equal to or exceeded 12
if (count >= 20)
// if (count >= 31) original
//if (count >= 99)
{
// Set the text value of our 'winText'
winText.text = "JUEGO COMPLETADO";

// Destroy (gameObject, 1.2f);

/////Application.LoadLevel (5);/////ORIGINALLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL
Application.LoadLevel (1);
}
}
}

---------------------------------------------------------------------------------------------------------------------

-------------------------------------------------------------------------------------------------------------------

Esta parte hace dos cosas suma el marcador y hace el cambio.


Luego al pasar a la escena de juego ganado o misión cumplida hay un simple texto en ella con dicho mensaje y contiene un script en C# que tiene la aplicación descarga ble y gratuita que viene con unity la “TextMesh Pro”.

Contiene diversos scripts en C# que hacen efectos visuales en las letras…..


Volviendo a la escena de acción desde las cámara esta el script en C# que produce los disparos, es el siguiente….

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

public class launchermasvelocidad2 : 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.1f;
}
}
}

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();
}
}


-------------------------------------------------------------------------------------------------------------------

-------------------------------------------------------------------------------------------------------------------

 

 

Y me dejaba el movimiento de la camara osea del dron por pantalla……..

 

 

 

 

 

 

 

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

public class desliza4sentidos : MonoBehaviour {


public float moveSpeed = 10f;
public float turnSpeed = 50f;


void Update ()
{



if (Input.GetKey(KeyCode.W))////funciona contantemente al apretar W mayusculas a de ser
//if (Input.GetKeyDown(KeyCode.W))// funciona pasito a pasito
//if(Input.GetKey(KeyCode.UpArrow))
//transform.Translate(Vector3.forward * moveSpeed * Time.deltaTime);
transform.Translate(-Vector3.down * moveSpeed * Time.deltaTime);

if (Input.GetKey(KeyCode.S))////funciona contantemente al apretar W mayusculas a de ser
//if(Input.GetKey(KeyCode.DownArrow))
//transform.Translate(-Vector3.forward * moveSpeed * Time.deltaTime);
transform.Translate(Vector3.down * moveSpeed * Time.deltaTime);

if (Input.GetKey(KeyCode.A))////funciona contantemente al apretar W mayusculas a de ser
//if(Input.GetKey(KeyCode.LeftArrow))
transform.Translate(Vector3.left * moveSpeed * Time.deltaTime);

if (Input.GetKey(KeyCode.D))////funciona contantemente al apretar W mayusculas a de ser

//if(Input.GetKey(KeyCode.RightArrow))
transform.Translate(-Vector3.left * moveSpeed * Time.deltaTime);
}
}



 

 

-----------------------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------------------------------

Este escrito por si solo es complicado de entender lo ampliare con un video explicativo….mas adelante...sin pausa ...pero sin prisa voy haciendo mi blog



https://youtu.be/lMTKzf17kvs

video tutorial