After having to take a hard reset this past weekend on development of what I’m tentatively calling Code Name: Arrow and Shield, it’s back working again. For some reason all of the scripts I had written had become unusable by unity, and no amount of googling would fix the issue, so I just started from scratch.
So what’s different this time around? Well, for starters, I’m attempting to using “managers” to handle all of the in-game stuff (for lack of a better word)
GameManager.cs controls all of the extra bits, such as super powers, power weapons, but eventually will contain all of the stats driving the game so that buffs/debuffs can be created.
I’m still trying to figure out the loot drop system and have purchased and asset that is supposed to do a lot of the heavy lifting for me, but in my limited experience I find that I end up having to change stuff more one those than I do on things I purpose built.
One of the more complicated things I’ve been able to navigate is how some of the script associations are managed. They’ll need to be extracted at some point and managed better, BUT at this juncture they all work. The weirdest one is the bow prefab. The arrow itself utilizes a projectile script that I modified to OnCollisionEnter check for a particular tag, then if it finds it, find the zombieHealth.cs file and apply the damage from the arrow to said zombie.
I’ll update later with some videos of it working. Pretty spectacular so far.
A lot has gotten done this week on the first shooting gallery, so lets start off with a high-res screenshot.
So what’s working right now? Pretty much everything. Which is awesome.
Game Time w/ Fastest Time
A word of advice to new coders – make sure that what you’re editing isn’t being used elsewhere…
I have two scripts, one named Timer, and the other named NewTimer. Half way through modifying Timer to do what I want, I realized that I’d changed it so far from what it was originally that it could no longer be utilized for the first arena sequence. It’s not the biggest of deals, since the new one is better and more versatile. So how does it work?
The first thing that has to happen is that the player has to hover their mouse over the console you see on the screen, thus triggering an OnMouseOver() function that triggers an animation. On the key press, a 3-2-1-Go animation triggers, with a chime on each number. That was surprisingly hard to build. First, I had to figure out how to reference the individual text objects, to which I built this monstrosity
So all of the HUDCanvas text elements are stored in an array called hudText. I didn’t know what the value was in the string, so I just wrote what I knew, which was I could get Debug.Log(“”) to print back out the name of whatever text object was in the array, and I want to say that originally the items I needed to change were 9,10,11, and 12. Great? Wrong. I got the function working, but then I moved an element in the HUDCanvas, and it shifted the value in the array, so I had to go back and figure out what the new values were. Total pain. Which leads us to…
So, the text within the animator only has a few values modified. X position, Y position, and Alpha. hudText.color.a grabs the alpha value and returns true when that value is equal to or greater than “0.9”. That part is actually pretty important. The reason the threshold is set so high is because due to it’s placement in void Update(), it doesn’t have time to refresh for every value change, only every frame, so setting it to == 1 meant that it would never fire, and lower than say, 0.5, would mean that it would be firing before the text was at 100% opacity, which doesn’t look or sound right. The highest value that I saw was .999946…
It won’t stay this way, as I’ll be trying to migrate the bulk of these events to the Game Controller script I started working on a while back.
So on to the timer.
This code lives inside a function called StopTimer(), that fires either manually through a keypress on the in game console, or when the game is finished.
Earlier in the script, the nuts and bolts of the timer control a float called time, which is a float that increases in direct correlation to Time.deltaTime.
I set currentTime = time, and when the function StopTimer() is used, it checks to see if the currentTime is less than or equal to a float called “BestTime”, which is stored in PlayerPrefs (Learn about this if you want to make leaderboards.) If none exists, currentTime is equal to currentTime, which it then sets as “BestTime” via PlayerPrefs.SetFloat(“BestTime”, currentTime”)
It’s not formatting the best time correctly just yet, but I still don’t understand everything about formatting strings. Anyway, I’ve got to go take an accounting test, but I hope that you’ve enjoyed this update as much as I’ve enjoyed coding the update, and if you want to see more code like this, leave a comment with what you’d like to see and I’ll put it in the next update!
The goal of today’s lunch break was to set up how the damage appears on screen in a way that feels arcade-like, and I think I’ve achieved that result. Also, I believe this is the first screenshot of what the game actually looks like.
There are two scripts that control this action. The first is “ArmControllerScript.cs” that sets a public int damagePerShot.
The second is “ZombieHealth.cs”, which has to do a few things to make this text appear on screen, but for the sake of brevity, we’ll just cover how it transfers the damage value, not the instantiation of the string value. The code looks something like this –
After battling a stomach bug (likely food poisoning) I was able to get in an afternoon of coding on a sick day. A lot of small changes were made, such as adding a “big zombie boss” which has a health of 1000(!), and making it to where the EndGame portal doesn’t spawn until after the final wave.
Made a bunch of UI changes that I think complement the game, and the aesthetic we’re going for.
I’ve cheated a little with this one, and snagged a menu maker store asset. I haven’t gotten a grip on how the are handling scene loading, but so far I like it.
Level Select Screen
Started on the groundwork that will become our level select screen. Will have, when complete, multiple planets, and stats tracking.
What’s not working:
High score system
The high score and fastest time systems aren’t behaving as the should. When you don’t achieve a new “high score” that “high score” text doesn’t appear in menu.
Fastest time system
The system does not track the fastest time. I need to confirm this, and then create a fix.
– Scoring in general is working, and the high score is tracked per user session
– Weapons shoot and damage enemies
-All animations are working at this time
-End game portal is working, and triggers the proper menu
-All menus that exist work
-Projectiles are actually shot from the gun. Right now it’s a bullet with casing, but whatever. Hits are still raycast and will be switched over to full bullet mechanics later.
-Weapon rarity. It exists, but is SUPER clunky, and will not be making an appearance anytime soon.
Whats Not Working:
-I don’t really like the current movement. Seems like a weird mix between too floaty, and the arms themselves aren’t “natural”.
– You can walk through the walls of the arena. Not great for “containment”.
-Physics. Still no idea what my goal is with the spawned “obstacles”. The zombies can just push them around, and if you shoot them, they fly away from the projectile. It’s fun, but I don’t like it just yet.
The guns that I’m using now work great, but aren’t ideal for the aesthetic of the game. Not a huge deal, but I’d like to make something more unique.
This one is a little trickier. There are several characteristics that could be modified, such as player speed, pick-up modifiers, super power time, etc.
Health, speed boost, ammo, etc
I’d like the player character to build up one particular resource, then be able to utilize a super power, such as an AOE blast, or slowing down time. Something. This will make an appearance in later builds.
I’ve got loot drops baked into the current build, but have disabled them due to how clunky they are.