Andrew Wang's profile

Stuffed - Extended (Code)

Stuffed - Extended (Code)
[File Name where Code is located]
My goal throughout the project was to create as much generalized code that I could then use for future projects because they should work with many situations. 
Some code is left in the project simply because it may have been unused, but I believe it could be useful for using or referencing in the future. 
[Globals] I tried and ended up liking a script that would contain all my variable so that when I needed to change any values I would know exactly where to go and it would be an easy change. It also made referencing very easy when referencing from other code.
[miniBearMovement] This was one of my first pieces of code that controlled the bear AI sprite orientation so that it would always look where it is going. The blue circle I made is code that I realized later on is repetitive code that creates clutter and I removed it from later code I created.
[BossAI] The switch statement I used to change between sets of attacks. I did it this way because then I can just call a different phase at the end of the current phase which I believe worked well.
[BossAI] This is part of one of boss attack sets that controlled everything from the hitbox, the sounds, and animation. The boss was one pieces of code made so many parts are brute forced to finish before the due date. 
[HurtBox] This was code I was able to generalize to use on every enemy as well as the player. This specific code shows how I specified when a hitbox can be and is hit. The damage is then found from a script containing damage values of attacks and subtracted from the hit enemy or player. The knockback is calculated from the Globals script and applied on the hit enemy or player. Finally, a stun time is found that makes the hit enemy or player unable to move which is performed above this snip of script.
[ChangeMusic] Simple generalized way I used to change music whenever the player got to a certain area. It finds and stops all sounds before starting the next song. 
[aAttacks] An example of how I created attacks for the player. The game is intended for gamepad (Xbox 360 controller) so I specified the direction or lack of direction required to perform each type of attack. This controlled the start lag, hitbox lingering time, and end lag of the attack and any movement for the character if the attack moved the character. Each attack starts the coroutine below.
[aAttacks] This coroutine puts the player in fighting status which makes them unable to perform certain actions and controls the hitbox GameObject meaning that it can hit stuff when active and stops hitting stuff when inactive. 
[Status] This is generalized code I was able to use on every enemy and player that allowed me to not have to repeat in each individual enemy or player in order to get values for all these variables.
[UniAniController] I used both code and the Unity animation system to perform animations. This is an example of how I triggered animation states in Unity through code.
[UniAI] The Unicorn was the last enemy and the last set of scripts I worked on. They ended up having to have some brute force methods to be finished in time. I used timers to control attacks and movement for the Unicorn to try to make it move like an annoying fly while having random like attacks.
There are more lines and scripts in the github at the top. These are just snips of code that I thought either were core to this project or shows my coding development throughout the project.
Stuffed - Extended (Code)
Published:

Stuffed - Extended (Code)

Code from Stuffed

Published: