Project Description
GAM 605, Scripting for Games 1; Final Project
This project was all about coming up with a unique gameplay mechanic and then figuring out how to implement it. I went with ball/chain lightning, because I’ve always enjoyed that attack in games and wanted to challenge myself to write it.
Basically, the player attacks with a raycast to their mouse pointer checking for an enemy collider; it then uses a line renderer to create the lightning bolt in segments, with some random variation in direction at each segment to simulate the stereotypical lightning bolt shape. The valid raycast also spawns a lightningOrb object on the enemy, which uses an OverlapCircle to get a list of enemies and then another line renderer coroutine to simulate lightning jumping between them. Each lightning jump has a chance to spawn another lightningOrb upon hit, thus creating the chains the proliferate throughout a crowd of enemies.
Unfortunately, the limitations of 8-way (well, mostly 4-way) movement in a 2D game meant that this mechanic wasn’t very useful for what I envisioned, which was using the lightning to stun and push enemies back as you fought your way out through a crowded corridor of say, zombies. Instead, I focused more on the attack chaining aspect and added some lightningRod objects to the game; single and double switch circuits that players could activate to animate environmental objects, open gates, or stop enemy spawners. With more time (and a budget more than $0), it would’ve been great to work it so that the city art was all cool colors like blues and purples and add some dynamic lighting to the lightning attacks so that the effect is more dramatic.