Dinopirates

Devblog 01

June 4, 2023

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.