Dev Log #1

This week, I mainly worked on improving my uni game jam project, Toxic Townsmen. If you haven’t seen it already, it’s a 2D wave shooter set in medieval times. It has 9 waves of enemies and a boss at the end. This past week I just spent a bit of time tweaking values and changing some features. When I originally posted the game, I made a mistake and forgot to change the player’s attack rate from 0, to 0.2 (from testing the game). So when people were testing it, the game felt easy as the player could fire as much as they wanted to. Fixing this was easy, and along with this fix, I also added another wave and made the boss harder.

Why? Because when I saw people playing the game, even though there was the firing bug, they all beat the boss on their first play-through. My intentions for the game was to make it difficult to defeat the boss. The player should lose around 1/3 of their health by the time they reach him on a good play-through, and then have a hard time defeating him. So I increased his health, made him do a quick-fire special attack when his health gets low and increase fire rate as well.

The mage enemy also had a few changes. Their homing orbs were made slower, so that they travel slightly slower than the player, rather than the same speed. This makes it so that the player can avoid them, yet have them still being an annoyance.

Also in the week, I helped my team member create our ragdoll physics game for week 2’s game jam. I worked on making the camera easier to use by implementing a zoom feature and the ability to orbit the camera around the ragdoll.

The zoom feature was created using the code below. Scrolling the mouse wheel either adds or subtracts the cameraDist variable, which is clamped to a min and max zoom. This variable is then used to calculate the camera’s position and distance from the target.

void Zoom ()
{
cameraDist += Input.GetAxis("Mouse ScrollWheel") * -zoomSpeed; cameraDist = Mathf.Clamp(cameraDist, minZoom, maxZoom);
Camera.main.transform.localPosition = Camera.main.transform.localPosition.normalized * cameraDist;
}

For the camera orbiting, I got the direction of the mouse movement and converted that to movement in the camera’s parent rotation. For this to work though, the camera needs to be a child of an empty game object that is at the position of the target you want to follow.

void Orbit ()
{
if(Input.GetMouseButtonDown(1)){
mousePosLastFrame = Input.mousePosition;
}

if(Input.GetMouseButton(1)){
Vector3 mouseDir = Input.mousePosition - mousePosLastFrame;
transform.eulerAngles += new Vector3(mouseDir.y, mouseDir.x, 0) * sensitivity * Time.deltaTime;
mousePosLastFrame = Input.mousePosition;
}
}