Pyrge 0.4 Released

in Programming

Valentine’s Day is usually about candy and flowers and chocolates and cards, but I don’t really have anyone to share that with. That might be bad for me, but that means that you get a brand new 0.4 version of Pyrge!

I know it’s only been a week since version 0.3 came out, but development is fast and furious as I find new things to add, and old bugs to fix! This is an incremental release, though, so there aren’t too many new things.

The one big addition is the ui module, giving you two types of buttons (regular and toggle) that are completely integrated with the game engine. You can change their colors, and use graphics or text, and, if that’s not enough, you can always make subclasses.

The ui module also comes with a third class: Console. This is what its name implies: a debug console that you can write to. This is for anyone that wants debug output, but doesn’t want to have (or need) a shell or terminal open while their games are running. The console doesn’t have too many options right now, but it’s a start for those who need it, and, as always, it works right along with the rest of the engine.

The rest of the brief change list includes:

  • A Text object whose autowidth property is set to True will now grow only to the right, instead of both left and right. This means that the left edge of the text will stay where you put it.
  • Text objects also now have support for newlines, which should be cross-platform, but that part is completely untested.
  • Images have a new redraw method, which forces a redraw in the next frame. (This replaces the old way of writing self.dirty = 1.)
  • Animations are better supported by both the Image.showFrame method, which goes to a specific frame number without animating, and the optional multiplier parameter of Image.addAnimation, that causes the animation frame changes to be slowed down by that factor. (For example, a multiplier of 3 will cause each frame to be displayed 3 times in succession before the next frame. In code terms, this means that [1,2,3] with a multiplier of 3 is a shorter way of writing [1,1,1,2,2,2,3,3,3].)
  • The new flatten function takes a sequence and returns a generator object that yields a flattened list, meaning that members of sublists (or tuples or any other sequence) become top-level elements. Example: The list [1,2,(3,4),[5,6,7],8], when flattened, produces [1,2,3,4,5,6,7,8].

Finally, tutorial files 6, 7, and 8 have been added to the distribution. I’m already working on a post that uses them. Until then, have fun coding!