domingo, 28 de febrero de 2016

Nerdy Run Día 1 | Nerdy Run Day 1

Español | English

Nerdy Run, ese es el nombre que había decidido para el momento y hasta ahora es con el que voy a seguir usando, siempre es importante que halla Tags en los nombre, así es más fácil de ser enontrado por Google.

Después de estar un rato tratando de descifrar las mecánicas que quiero utilizar me pude decidir, como siempre hago, primero voy a hacer el juego con comando para PC (por lo que voy a usar las flechitas del teclado) y para cuando vaya terminando el juego traspaso esos controles a los controles de Android.

El juego tiene una lógica parecida al anterior salvo que para nuestro personaje, la gravedad no afecta (esto se logró modificando el valor de gravity Scale a cero en el Rigidbody2D de nuestro Player). Lo único que iremos haciendo es subir o bajar para esquivar obstáculos, el código que utilicé para esto fue:

        player.position += new Vector3(velocidad, 0, 0);
        if (Input.GetKey(KeyCode.UpArrow)) {            
            player.Translate(Vector3.up * desplazamiento);
        }
La primera parte es la que hace que siempre vayamos para adelante, mientras que la segunda hace que si presionamos la flecha para arriba, el Transform del jugador se traslade hacia arriba. Por lo que multiplicamos a Vector3.up (vector unitario en Y) por la velocidad a la que queremos que se desplace.

Por supuesto había que crear una especie de "área" en donde el jugador se puede mover, por lo que para eso creé un cubo alargado (modificando su escala en X) que sea de la medida del área de la cámara y que este, uno justo encima de esta y otro, por debajo. Esto lo que hace es limitar hasta donde nos podemos mover, creando unos "bordes" o "paredes".





Lo que queda por hacer es terminar los Spawn (unos objetos que van a hacer que aparezcan otros objetos) de obstáculos y con eso tenemos un nuevo Infinite Runner. Pero recordemos que por ahora estoy utilizando solamente cubos, luego hay que añadir el arte. Pero el segundo paso sería crear los "mini-juegos" que el juego va a tener.

-L




-------------------------------------------------------------------------
English


Nerdy Run, thats the name I've decided at that moment and its the name I'll keep using, its always important that you use Tags on the name, so it is easier to be found by Google.

After being a while trying to figure out the mechanics I want to use I finally decided. As I always do, I'll first make the game with controlls for the PC  (so it can use the keyboard arrows) and when I've finish the most parts of the game I switch the controlls to let the game be played on Android.

The game is going to have a similar logic to my last game but this time the character is not effected by gravity (this was achieved by setting the gravity Scale value to 0 on the Rigidbody2D of the Player). The only thing the player is going to do is to move up and down, for this I used this code:

 player.position += new Vector3(velocidad, 0, 0);
        if (Input.GetKey(KeyCode.UpArrow)) {            
            player.Translate(Vector3.up * desplazamiento);
        }

The first part makes us always move forward, while the second one checks if we have pressed the "up arrow", if we did, the Transform of the Player will be translated up. For that we multiply the unitary vector "Vector3.up" with the velocity for which we want the player to move.

Of course it need to be created an "area" where the player can moves, for this I created a cube and modified its X value so it is the same size as the camera screen area, then I placed one above and one below this camera's area, creating this "borders" or "walls" where we can move.



What it's left is to finish the Obstacles' Spawners (objets that will spawn other objects) and we have a new Infinite Runner. But remember that I'm currently using cubes, the art will need to be added later. The second step would be to create the "mini-games" the game will have.

-L

No hay comentarios.:

Publicar un comentario