I couldn’t decide on a new project to start today, so I decided to return to my 2048 project, and add in animations, like I talked about maybe doing. As I had expected, it required a fairly bottom-up alteration to the system, though it was an interesting way to look back on what I had done, and reason my way through code I had written previously. I optimized what I had down last week a lot based on what I have learned: using optional types to limit variable declaration requirements and the like. Animations themselves were useful because I got a chance to get a lot more practice with SKNodes, the UI elements of swift. I’ve worked with them this whole time, and in the Candy Crush tutorial, but now I really delved into the documentation to look up how to retrieve parents, remove children, and display what I wanted. The biggest overhaul was in the way I displayed the new screen.
I used to accomplish this by simply creating a new node, and recreating all sprite images. I had thought my animation would be a fade in of the new node, and a fade out of the old node, and then removing the old node from my master node which I would create. Instead however, I directly integrated nodal management in my animation method, so not only does it animate the tiles moving around, it also adjusts the node accordingly, so now I only ever create one node. I also learned a little more about enumerations today, though I still don’t fully understand their purpose; everything they do seems to be accomplishable with simple code. What I really need to better learn is to how to start a non game application from scratch, which is what I will start tomorrow with a restaurant ratings application that I will struggle through to do without a tutorial (though I may glance at a storyboard tutorial if needed). As soon as we get the developer licenses I will switch to gyroscope driven applications. I also will spend some time tomorrow making a scrolling text application, where the speed of the text is modulated by button presses, and then I will be able to adapt that framework to be gyroscopically controlled.