Friday, April 21, 2017

TOE week 34: To do list. Idem 1: Make To Do List.



After last week was over, I opened up a blank text file and started to write down all of the things that I had pretty much avoided doing because they are annoying, difficult or both. This involved me sitting down with the game for about a half hour and really looking at it. Some of these tasks are rather huge. Like show code to a professional engineer so they can yell at me for an hour about inconsistencies with bools and ‘{}’. Also about where I need to refactor the code.  Again not really a programmer so small inconsistencies don’t really bother me very much but I have talked to a few in my time about {} and tabs and spaces. Also if you’re a spaces person YOU ARE insane. What? Fight me! Anyway not a small task. 

Another thing that happens as you do this is you find other things that are either not quite right or not working and the list gets longer. However it seems to be another way to really help me keep my eyes on the goal. One of my goals this week was to get the player’s weapons to spawn after the animation was finished. I believe there was one fruitless day devoted to this.

Did you know that Unity’s animation system is kind of bonkers? While I didn’t until I tried to get an Animator(an object that over sees Animation objects) to see an Animation. This shouldn’t be difficult I would think. I have an Animator that switches what animation is playing. I mistakenly thought that an Animator would have a method to know when a containing animation was finished. If you guessed that this is actually not the case then you win a prize. I Googled how to check when an animation is finished Untiy many a time and got at lot of wishy washy work arounds or doing it from the Animation class not the animator. 

Somewhere on some forum someone clearly smarter than me said ‘the Animator and the Animation objects intentionally don’t know about each other for Unity’s performance reasons’. Well that is great and all but how do I get a collision object to spawn when the animation is done? I found a thread about using the Animation Event System. Basically you can put a function call on a key frame of the Animation that calls to the Animator. To do this you have to do it in the Unity Editor and not in Code. Also this breaks a segment of your code basically exiting in the Unity Editor so if you want to change it you have to remember where the Animation Event is in Untiy. Not hard to do if you leave a comment in the code that says ‘Hey Dummy it is in Untiy’. It seemed kind of hacky but as far as I could tell, was actually the way you’re SUPPOSED to do it.

In easier news I managed to create a variable frame rate for my run cycle based on Player input for the left analog stick. Pretty much what this means is that the player’s run cycle animates faster or slower based on the degree of the tilt. It is a simple and really cool effect that I don’t see as often as I think it should be. It is so easy to do it should almost be mandatory. 

I have several other different accomplishments that I could talk about but this has already gotten a little long and I didn’t get around to talking about modular art. Oh well maybe next week. Great news! I already have a list of things that I didn’t manage to get done this week that I can now try to deal with next week!

No comments:

Post a Comment