I was quite pleased with the game I made for problem set 0. The one thing I wasn’t happy with was the player movement, which was very fiddly and certainly not smooth.
I shared the game on twitter, and midway through this afternoon I got a message from @ArsenaliansCom saying thanking me for the game, but suggesting that the movement should be improved.
I liked the suggestion that a series of ‘if’ statements could allow for smoother movement.
I got home and thought about how I could rework my code on this basis, converting my existing movement code into something using a single looping if statement structure.
The Academic Honesty agreement for this course states that “you may not share code”, so I won’t show you a ‘before and after’.
Whilst this restricts what I can write about here somewhat, I don’t actually think this is a bad thing. I would hate to ever use code that I hadn’t created or understood fully. So in implementing these improvements, I was very careful to only use the overarching advice – that using a set of if statements together could be helpful. Academic Honesty agreements aside, I want to figure out things for myself, and to craft them myself, because that is how learning happens.
After introducing the initial change to the movement I had to change a few other things:
Player movement was a bit too fast, so I decreased sped and rotation speed.
It was hard to get the ghosts chasing at the right speed – there’s a fine balance between almost inevitably being caught and having an easy time of escaping. I got this as close as I could, and then added in another semi-randomly moving and bouncing mouth ghost. I found that having two of bouncing ghosts made things much trickier, so I had to increase player movement a bit to give them a fighting chance.
I’m pleased with the results of these improvements – the game is now much smoother:
What improvements have the rest of you made to your games?