Saturday, April 29, 2017

TOE week 35: Infinite Death Star the Only Way to Time Travel

Last week I hacked another thing with animations the attack animation. I don’t know if it was a hack per say but it was implemented in an ugly way. This week it came back to haunt me. One of the things that seems to happen fairly often in development is that you play your game in a certain way. So certain bugs will pop up because of your style of play. Hand the controller to a friend who doesn’t know anything about your game and their style of play reveals places where your code is lacking.
I wasn’t miffed that my friend broke the game. I was pretty vexed that I couldn’t fix it. The way the code works is something like this. 

Player class sees and input from actual player when X is pressed. This sets a flag to true.

Player Animation class is connected to Player class so the attack animation is triggered to play when the flag is true.

When the animation is finished the flag is set to false because of Untiy’s animation event trigger.

The hiccup is if the actual player jams on the Attack Button. Then the flag is always true and then the player is stuck at the last frame of this animation basically unable to move. Because the flag is never cleared. 

I spent the better half of Wednesday (my most useful day because Son has no appointments on Wednesday) trying to get this fixed. To no avail. I also tried to fix it on Thursday and was again completely unproductive. Basically felt like I wasted two days. On Thursday I walked away and just painted stuff. I think I need to create a test project with just this situation isolated to sort it out if I am going to fix this.  

I have been working on a lot of little broken things. For example my artwork with collision objects has no rotation value. All of the collision objects are various different parallelograms. Implementing this broke my grenade weapon that grabbed the rotation value and rotated itself then exploded. With no rotation value this functionality was gone. So I had to fix it. My player gets the angle of an object that they touch from a raycast I used this to get the angle of the same collision objects but my player doesn’t care if the angle is -37 or 37. The grenade object needed to care so basically my thrown grenades only functioned correctly when hitting an object that was 37 and not -37. Not being able to find an elegant solution I opted for a something maybe a bit hacky. Hacky but it works! I sure this hack will never come back to haunt me ever again.

I also checked off creating artwork for the way back portal.  It was then that I accidentally created the infinite death star. It is just looked a bit like the death star not fully operational as of yet. I did this while not fixing the player attacking problem. I think it is a fitting representation of traveling through time. So not a total loss but not my best week either. 


No comments:

Post a Comment