Turnament Devlog #3


I implemented the turning of fields, which is more or less what the game is about! I was able to 100% use the existing grid system of Catty & Batty - one more reason why re-using the project was a good idea.

Basically, it creates a gameobject on every coordinate (0/0, 1/0, etc.) within given boundaries. This gameobject has a "GridField" class now, which has an "is_activated" boolean variable. It has a sprite of the field, functions to activate and deactivate it, and it can play its animator for the turning motion, which rotates the sprite. The turning motion is in 3D space, so in theory i could make the camera use perspective instead of orthographic, which could lead to some cool 3D effects, but that's something I'll keep in mind for later.

I also fixed the mouse cursor, it simply wasn't assigned correctly to the player gameObject. I didn't make it a 1:1 translation of the movement of the cursor, because when clicking and dragging over the game space, sometimes it would skip a square and not turn it. I assume that's a missing frame because of the fast mouse cursor movement. Instead, I kept the "move towards target position" code from Catty & Batty and just sped it up a tiny bit.

Next were the seekers, which can be selected and moved around.

I made a seeker prefab, and another one for the cursor that appears around the active seeker. I let them select/deselect on firing on the same coordinate of the player's cursor, and also added deselection when pressing "cancel". It works pretty well now with mouse and controller. Switching between multiple seekers was as easy as checking if there's already an active one and simply deselecting that one.

It looks a bit wonky here because it was skipping the first input, but that's because of a code that skips the first second or so after the level has loaded (to avoid doing an action right after hitting X on the last sentence of the cutscene). (The yellow circle is from the gif recording program I'm using ("Screen to Gif").)

You can see that the target position isn't in the center just yet, i will fix that later on. The cool thing about this is that it's all using the same Projectile class, so fixing it will improve it for every other prefab that uses it.

It's a bit tricky because in strategy games you select with left-click, and then tell it to go somewhere with right-click. But if you play on controller (and I'm using the Playstation buttons now), you want to select with X, and then target with X again. You expect Circle to cancel the selection. So right now, right-click also cancels the selection. We'll see in playtesting if people notice or if it's okay because right now, right-clicking also "cancels" a turned field and returns it to normal. This will be fun to figure out. :D

Next were the crystals and letting seekers collect them.

For this, I needed to add a Circle Collider 2D and Rigidbody 2D to seekers and crystals, making the collider circles just the right size of the sprites, and then adding OnTriggerEnter2D on the seekers to check and collect the crystals.

I added some code to the Gamemaster as well to check if all crystals have been collected, and if yes, end the level. Which, right now, looks like this:

Yup, Catty & Batty are still in there! :D

For testing purposes, I also added the keyboard shortcuts from the old game already as well: Directly accessing seekers with numbers (1 activates the first, 2 the second, etc.), while the spacebar selects the last selected seeker or deselects it. And L1/R1 on the controller cycles through them quickly.

The animations are still missing (collection animation and explosion animation), but this will be something for future Philipp.

Next up will be collisions of seekers against projectiles and creators, broken fields and destroying projectiles with turning fields.

To be continued... 💎