Saturday, August 18, 2018

TOE week 61: the Hard Work that You Can't See


I have been feeling like working on this gargantuan project once again. Real talk I had been pretty depressed for a while and working on this just didn’t help with that. So I had been painting because that did help. Having a day job where people think your opinion matters and respect you for it DOES wonders for depression. Take two of that and call me in the morning. 

Also fighting with AI is still not something that I look forward to so working on THAT just didn’t feel worth it. With the time I’ve had on my two breaks though I could have probably put some of that to bed… That just makes me think about depressing thoughts all over again though so let’s stop talking about that. 

I only got to work on my game for about three days this week but the work that was done was still very productive. I wanted to make platforms that switch positions when the portal touched a switch object. I already had moving platforms but they didn’t have any code to stop moving so I kind of hacked them to do what I wanted with only a couple of bugs. Mainly that if the switch got hit too many times in a short period of time the start and end positions would basically flip.

I also had to make a switch manager that basically would flip its bool if any switch was hit and the switches would then all update. This was fairly easy once I remembered how to properly reference a script that wasn’t in the object. 

I finished it in about three hours and was pleased with myself.

Next day I created platforms that would rotate depending on if the player hit the switch. I had to ask for help on the Facebook Unity group I’m a member of to get this working. They didn’t actually help me but the interaction pointed me in the general vicinity of the problem. So I deleted everything a hacked in a crappy version that just added to the rotation value of the object every frame if the conditions were correct. It is a pretty crap solution to a problem that lerp should have addressed. Once it was working with my garbage fix I then deleted that fix and set up a solution using lerp and turns out I just needed to reset a variable for it to work correctly. 

I felt somewhat vindicated but silly that the result was almost exactly the same with just more control of the speed of rotation. 

Today I then looked back at my moving platforms and basically thought that I could make them work in the same way as the rotation I set up yesterday. Three or four hours later I basically had a bugless version of the thing I built two days ago. Again I redid work but the results are the same… 

Don’t get me wrong better code is always better but you would know it was different from looking at it.

This is what all of the work looks like. 


No comments:

Post a Comment