Dinopirates

Devblog 01

June 4, 2023

Original

Shooting Stars

One part that isn’t even defined in my game but I know its a MUST its a shooting mini-game, I mean, if you are in a spaceship and you can’t shoot its a boring game, specially when the main idea of your game its being a rail shooter.

So my approach was easy, I just need to draw on screen the lasers and the ship, nothing hard, for this ill define the position of each shooter and then set the end of the line to the center of the crosshair. With a little of parameters magic and simple math, like really simple. Pium Pium.

Setting up

First I created 3 objects, a ship, a crosshair and a “mini” ship all of them react to the d-pad movement, the ship just rotates and change the asset depending of the button you press, and the crosshair just moves around the screen.

For the crosshair I set simple conditions to make it back to the center of the screen, its literally a counter backwards that change the position to the center, not even when you release the button, its always going back to the center. At this point I was thinking of having a big picture of the ship as part of the UI, so when you receive damage you see it directly in the ship Illustration, cool idea but add a lot of asset creation and took a bunch of screen space just for nothing, maybe I’ll re implement this idea in a different way later. but for this iteration DELETED.

space time
The main UI, with everything, the crosshair, the ship and the "ship hud".

Shooting

In theory making the ship shooting was gonna be easy, for the start wanted something easy so a straight line was going to be more than enough, so, I just grab the center position of the crosshair, each of the shooter positions, and draw a line between each of those points, for making it disappear I took the worst approach ever. the laser its draw every frame, but with a clear color, and when you press the button the color changes, and when the button its released the color changes to clear again. Kinda a smart way to do it but really CPU and RAM consuming. Also the laser was being rendered on top of the ship.

space time
Wrong Z-index my friend.

Since the solution wasn’t as easy as just change the Z-index, opted for drawing in a separate image and assign that image to a sprite, which gave me more methods and access to the Z-index, for this just made a test entity were it draws a circle every time I press the button and paint it back to clear on release, here comes more bugs.

space time
The rising space sun.

Well problem solved, now just need to do the same with the lasers instead of the unfunny sun

space time
NOPE, that's not how development work.

As you can see the lasers weren’t clearing themselves, so new approach, this time with timers, which also allows me to create charging lasers, so this time after a few frames the lasers disappears, problem solved, un solved, and resolved.

space time
Sweet pixelated laser violence.

Also added some FX to the shooting, but gonna change it cuz you can barely see it. I almost forgot that for the moving shooter starting position had to add some modifiers to the calculation according to the position of the ship. Next step its create a “galaxy” to create movement.


I tend to say a lot of “easy”, when isn’t that “easy” but it’s my toxic trait to simplify everything I do when isn’t that easy or simple.

Estrellas que Disparan

Una parte que ni siquiera está definida en mi juego pero que sé que es OBLIGATORIA es un mini-juego de disparos. Quiero decir, si estás en una nave espacial y no puedes disparar es un juego aburrido, especialmente cuando la idea principal de tu juego es ser un rail shooter.

Así que mi enfoque fue sencillo: solo necesito dibujar en pantalla los lasers y la nave. Nada difícil. Para esto definiré la posición de cada cañón y luego estableceré el final de la línea al centro de la mira. Con un poco de magia de parámetros y matemática simple, en serio muy simple. Pium Pium.

Configuración

Primero creé 3 objetos: una nave, una mira y una nave “mini”. Todos reaccionan al movimiento del d-pad. La nave solo rota y cambia el asset dependiendo del botón que presiones, y la mira solo se mueve por la pantalla.

Para la mira establecí condiciones simples para que vuelva al centro de la pantalla. Es literalmente un contador regresivo que cambia la posición al centro, incluso sin soltar el botón, siempre está volviendo al centro. En ese punto pensé en tener una imagen grande de la nave como parte de la UI, para que cuando recibas daño lo veas directamente en la ilustración de la nave. Buena idea, pero agrega mucha creación de assets y ocupa mucho espacio en pantalla para nada. Quizás reimplementaré esta idea de otra forma más adelante. Pero para esta iteración: ELIMINADO.

el espacio y el tiempo
La UI principal, con todo: la mira, la nave y el "hud de la nave".

Disparos

En teoría hacer que la nave disparara iba a ser fácil. Para empezar quería algo simple, así que una línea recta iba a ser más que suficiente. Agarré la posición central de la mira, la posición de cada cañón, y dibujé una línea entre cada uno de esos puntos. Para hacerla desaparecer tomé el peor enfoque posible: el laser se dibuja en cada frame pero con un color transparente. Cuando presionas el botón el color cambia, y cuando lo sueltas vuelve a transparente. Una manera bastante inteligente de hacerlo, pero realmente consume mucho CPU y RAM. Además el laser se estaba renderizando encima de la nave.

el espacio y el tiempo
Z-index equivocado, amigo.

Como la solución no era tan simple como cambiar el Z-index, opté por dibujar en una imagen separada y asignar esa imagen a un sprite. Esto me dio más métodos y acceso al Z-index. Para esto hice una entidad de prueba donde dibuja un círculo cada vez que presiono el botón y lo pinta de transparente al soltarlo. Aquí llegan más bugs.

el espacio y el tiempo
El sol espacial que se levanta.

Bueno, problema resuelto, ahora solo necesito hacer lo mismo con los lasers en lugar del sol sin gracia

el espacio y el tiempo
NOPE, así no funciona el desarrollo.

Como pueden ver, los lasers no se estaban borrando solos. Así que nuevo enfoque, esta vez con timers, lo que también me permite crear lasers de carga. Así que esta vez después de algunos frames los lasers desaparecen. Problema resuelto, no resuelto, y resuelto de nuevo.

el espacio y el tiempo
Dulce violencia láser pixelada.

También agregué algunos FX a los disparos, pero voy a cambiarlo porque apenas se ve. Casi olvidé que para la posición inicial del cañón en movimiento tuve que agregar algunos modificadores al cálculo según la posición de la nave. El siguiente paso es crear una “galaxia” para generar movimiento.


Suelo decir mucho “fácil” cuando no es tan “fácil”, pero es mi rasgo tóxico simplificar todo lo que hago cuando no es tan fácil ni simple.