Day 3: smarter baddies :)I spent most of today at the science museum with my family; my daughter absolutely loved the planetarium show and thought some of the Star Wars exhibit and regular exhibits were cool too. Science!
On the game front though, I managed to get some new code in:
- proper sprites for effects
- using Inkscape's rasterisation for some smaller in-game graphics now
- first tree & house
- added ledges - can move through sides & bottom but not fall through top
- baddies follow complex paths including loops and open paths
- fleshed out the structure of level 1 more
The baddies follow paths properly now (yesterday they just when from point A to point B and back again). The really neat bit is that the code to handle the pathing is:
path = itertools.cycle(path)
last = euclid.Point2(*path.next())
next = euclid.Point2(*path.next())
last = yield euclid.LineSegment2(last, next)
Given a path consisting of (x, y) points. If the path is a loop (path == path[-1]) then I create the path cycler with cycle_path(path[:-1]). If the path is open then I create the cycler with cycle_path(path[:-1] + list(reversed(path))[:-1]) (so bounce from end to end).
I pass in the current position when I ask for the next line segment so that there's no unsightly jump to move the baddie from its current position to the "proper" start position for the next segment. The baddies wobble along their path, you see :)
So not a huge amount of progress today but I'm very happy with how it's progressing regardless.
Comments: (log in to comment)