Clockwork TD Devlog #5: Terrain Bonuses

This is the fifth post in an ongoing series about the development of my thesis project, Clockwork TD.

Terrain bonuses, ala Rogue Tower, were something I decided I wanted early on in order to add to the randomness of each playthrough. Tiles are simply assigned a random TileBonus from 0-3 at creation, then moved up and color lerped in order to match, while the CursorState uses this Bonus value to generate the floating text on hover:

Bonus = Random.Range(0, 4);
transform.localScale = + Vector3.up * (Bonus * .5f + 1f);
var color = Color.Lerp(renderer.material.color, Color.white, Bonus / 5f);
renderer.material.color = color;

Stats in the game use the SeawispHunter.Roleplay.Attributes package, which provides an amazing framework for working with all sorts of RPG stats. The Tower Bonus is assigned at time of tower placement; this pattern is used for all Upgradeable stats throughout the game, allowing trickle-down from the Tower Setup to the individual tower level.

// add 1% to each stat for each level of tile bonus
TileBonus = new ModifiableValue<int>(0);
var rangeMod = TileBonus.Select(x => 1f + x / 100f);

I had used Kryzarel’s CharacterStat framework in previous RPG stat projects, but found the SeawispHunter package at the start of this project. It’s really powerful and flexible, and highly recommended! Next time around, we’ll take a look at generating / showing the next enemy wave.