Day 5: Collision detection, new rendering engine
Today hasn't been great, but well... that's "planning" in my book.I did the collision detection and I'm very happy with the results. I tried to make the movement as fluid as possible, making "subtle corrections" in the trajectory to make easier to the player to move around without getting stuck (some locations may be a little bit narrow).
I'm too tired to explain how it works, but I can point you to this post instead: http://old.troygilbert.com/2006/10/the-movement-and-attack-mechanics-of-the-legend-of-zelda/
I've been worrying all the time that implementing that kind of collision detection would be too expensive but the end result is really smooth and the frame rate is still 60 FPS with plain Python and pyglet (no numpy or fancy stuff like that!).
Then I started to deal with the animations of the scene (ie. a door opens) and there you go, three hours wasted :(. Basically I had to rewrite the rendering engine to render different layers in different steps so I could animate the doors in the foreground layer without wasting time with the background layer. Now I can invalidate just one layer. Again, 60 FPS. Yay!
I misunderstood how tile layers work in tiled and turns out that what I was planning to do can't be done :'(. I've been looking for a solution and I think I can make it work but I guess that I'm moving the "spaghetti code" expression to the next level. It's all right, that's part of a PyWeek :)
Finally the story is more or less clear. I think I can provide a good experience (don't know for how long).
The spirits are high, although I have lots of things to do and only two days left!