Devlog 2


This second devlog will cover the topic basic level blocking.

The first thing I needed to do was create a camera that would keep track of all characters at the same time, no matter where they were. In order to do this I used the cinemachine provided in unity. I used the target group camera cinemachine to achieve this, and messed around with the values until it felt right. Not entirely sure what the heck I did exactly, but the camera I had felt good, at least for now.

Figure 1: Showcase of camera movement


The next thing to do was to make sure that players could respawn after 'dying'. This was done by creating an empty game object with a component that would be called after a character dies. A character dies by having its sprite renderer, among other things be disabled, and the empty game object (respawner) will teleport the character to a chosen location and reenable the previously disabled components. However, this is not done instantly, instead a coroutine is activated right after the character dies. After 3 seconds (or however long), the character will then be respawned. This was done to make the player understands that the character died,  and is then ready for when the character respawns. 


Figure 2: Red character dying to spike, then respawning at a different location.


Last time when a character touched the mist it would instantly print the word 'dead'. However, it doesn't make sense for the red and white characters to instantly die when they touch water, as they are meant to be robots. A robot could sustain against water for a little bit until they die. So, in terms of the mist, instead of instantly dying, the red and white characters would die if they stayed in the mist for too long, specifically 3 seconds. 

However, if they enter the mist, then leave, they could survive, as they would have time to dry off. In order to do this, I needed to keep track of when a character entered and exited the mist. I did this using a simple boolean that was either 'true' (when a character entered the mist) or 'false' when a character exited the mist. When the character enters the mist a coroutine also starts for 3 seconds. When the 3 seconds have past, if the boolean is still 'true' a seperate boolean will then become 'true', this will instantly kill the character. I was able to use this to my advantage when designing a section of the level, where one of the characters would have to duck in and out of the mist.


Figure 3: The white character showcasing how the mist doesn't instantly kill you.


Next was to design a basic level for people to play test on. This level would also implement the level blocking aspect of this devlog's topic. The level had 3 sections. A red character section, platforms were placed in such a way that only the red guy could access. A purple character section, filled with mist, which the purple character can survive (due to not being a robot). And a white character section, which consists of a small tunnel that only the white character can fit through, as well as a showcase of how the mist works. Spikes would also be placed every now and then to showcase their deadlines. 


Figure 4: The level layout that was presented to the class for feedback.


Before the next class had started, there was still some spare time to work on the next feature, the lasier. The lasier is a laser that the small white character controls. It can be used to destroy burnable objects (or even burnable players). The lasier works from a seperate game object that is a child of the white character. It is simply a rectangle for now, and can be aimed upwards and downwards. Various things were trialed such as using hinge joints to create a limit to how much the lasier can be rotated (so it doesn't just flip around forever). Eventually, I discovered  what was needed to work. I would simply rotate the object using transform. Rotate while also keeping track of the current rotation. If the rotation is less than 45, the player has the ability to rotate the lasier upwards. If the rotation is greater than -45, the player has the ability to rotate the lasier downwards. The lasier is controlled with I and K as this works well with the other white characters controls, J and L. 

When it comes to firin mah laser, raycasts are needed. If I and K are pressed at the same time, the lasier gets fired. This means that a raycast is created consisting of the current position of the lasier game object, the direction the lasier is being fired (which is always to the right, more on that later), an infinite distance, and a layer mask that can be set in the inspector. The lasier then goes through a bunch of checks before creating the line. Firstly, if the lasier hits something with the tag 'burnable' it destroys it. Secondly, if the lasier hits a player, it kills it (not destroys (it basically sets a boolean in the die on spike component to true (thus 'killing' it))). Thirdly, if it's anything else, it just draws the line with the end point being the thing it hit. And lastly if it doesn't hit anything the lasier end point is very, very far away. A line is created using line renderer and the setting at default. At the moment the lasier laser stays on screen until a new one is shot.


Figure 5: Showcase of the lasier moving up and down and firing (and killing 2 of the characters at once).


Feedback:

Before receiving feedback I had not yet finished the lasier, only having it exist (ie not be able to kill anything).

A bug had been found where I forgot to add a single of code to the die in water script (that I had in the die in spike script) so that was quickly fixed. Apart from that (and the laser not killing anything and staying on the screen) everything worked as intended and no other feedback was given. 


Other additions:

After feedback, I had some spare time to work more on the game, and I got quite a bit done. Firstly, I properly finished the lasier, now it could kill players and destroy burnable object. Speaking of burnable objects, I also created some objects coloured brown (like wood?) and gave them the tag burnable, so they could be destroyed.

 

I also created a checkpoint system, which took a while to figure out how to work. Creating a system where if something entered an area, the location for where the characters would spawn would be updated, I had to keep in mind that all characters had to be at the checkpoint for it to update (because if only 1 character got there, the others could just die and respawn at the checkpoint) but also that this game would have character selection (of different characters and a different number of them). So what I ended up figuring out is that when the game first starts, I have a game object (the respawner game object from before actually) that has a box collider (as a trigger), big enough so that the 3 characters fit inside. Using a custom script, the respawner game object counts all colliders that are inside the respawner game object and puts them in an array. The respawner game object then goes through each item in the list and checks to see if they have the tag 'player'. If yes, then add a counter by 1. Once it is done, the counter variable (in this case) is at 3. This variable is public, and so can be accessed from any other game object. 

A seperate game object is created, a gold diamond shape, which will act as the game's checkpoint. The checkpoint has a custom script that checks when something enter's its polygon collider's hitbox. If the thing entering has the tag 'player', then a counter gets added by one. If the counter ever equals the counter variable from the respawn object (ie when the total amount of players that are in the game enter the checkpoint), the location of where the players respawn is updated to the checkpoints location.  With a checkpoint system working, and various things for the characters to interact with (ie the mist, burnable objects, spikes, checkpoints and platforms), I created a bigger level block, this time with more functionality and showcases more of what the game will offer. I also updated some of the previous areas to make them easier and to act more as a tutorial of the different functions.



Figure 6: Very zoomed out shot of the whole level, although hard to see there are 2 checkpoints, the more white objects are spikes, the brown objects are burnable objects and the light blue areas is the mist. There are also various ledges and areas that don't need to be reached, but could be if you wanted to show off.



Figure 7: Showcase of burnable objects, as well as the checkpoint (and mist I guess (and the lasier I guess also)).


Closing thoughts:

So that was all I got done this week, which was a fair bit, but a lot of it was getting the basic things finished as the game doesn't have a lot of polish. Goals for next week consist of getting the lasier to disappear after a bit, letting the player to choose their character, as well as a 2nd player to choose their character (and maybe even a third player?). Also fully designing this level block level to act as a sort of sandbox level (that won't be a part of the main game as the main game will consist of smaller levels).

Files

Build 10.zip Play in browser
20 days ago

Leave a comment

Log in with itch.io to leave a comment.