Friday, February 3, 2017

TOE week 23: Consistent Inconsistency



I worked on consistency this week. Last week I worked on the background plugged it in and things were humming along. Wrote a blog about it and published it. When my wife got home I showed her the thing that I had been working on and it looked slightly wrong. The background jumped around and was not smoothly in place. My secondary weapons began to act up when I checked them. 

So I spent a day looking into this problem. I asked a question on the Unity Facebook group I’m a part of and was told that I should be using Time.FixedDeltaTime instead of Time.DeltaTime and that I shouldn’t have public editor values. Wat?! One of the great things about Unity is public editor values! When you first write code you don’t immediately know that a value of 7 for a force will send the thrown axe careening off into the infinite. You just make a guess of a good value then when you see it working for the first time, and the force is too strong or weak, you adjust it in game, find a value that works, and then leave it the hell alone. Very rarely to never have I coded something in Visual Studio and it just worked perfectly with my guess-timates. 

The issue I have been having doesn’t seem like I changed something else and it impacted the secondary weapons either. I would be thrilled if it was that easy of a problem to solve. This issue seems to pop up depending on  the opening Unity. It also sticks around broken or working for little while. It was broken all of last weekend and worked correctly all of the week and was broken when I opened it today. It breaks and fixes itself regardless of anything I seem to do. Yay…..

I grabbed my Sprite sheet off of my storage hard drive. I got all of the animations in Unity and working. Well that is to say that I managed to import all of them into Unity and they animate. So far as the player animating the only thing I have working right now is making the player sprite flip when you are heading left or right. Man oh man animation in Unity seems complicated! Well that and I have basically never done it before. Maybe some basic things but this is pretty crazy.
Related to this I did write a Player state machine to tell the Animator what animation to display. I haven’t quite yet figured out how to swap animations on the player. I looked at some tutorials on how to do this but I wasn’t really happy with them. But it did also make this: 



For those uninitiated in Unity that is an animation graph. Basically all of the animations are allowed to transition into any connected animation. I just have to get it working… Unfortunately that might mean actually doing one of the tutorials in a separate project to really understand how really implement my sprite animations. So close! Maybe next week I can wow all four of you with a video of the player running around. I could do it right now but it would be complete trickery.

No comments:

Post a Comment