Ninja Tower 1.0 released

We're done:

Make sure you have someone to play against! It's not a lot of fun with only one player and I had no time to write an AI (it would have taken a week on its own I guess).

We finished the sounds today and I think they complete the personality of the game very nicely. I'm the voice of the left ninja and my wife, Beata has voiced the ninja on the right. I have also framed the game with instructions (like in the image above) and gameover screens today, so it will hopefully give the impression of a proper game to casual observers. The game starts up with a randomly chosen song (of a set of 3), so do not be alarmed if you hear very off-key whistling — a simple restart will probably fix it.

Although our towers do not sway I hope they can still be called wibbly-wobbly. They look really unstable when cut the right way!

I resisted playing your games until now, but I am looking forward to indulging myself next week! Have a nice Easter!

(log in to comment)


in windows xp
At 1st got a traceback:

Traceback (most recent call last):
File "D:\tmp\_pyweek10_previa\ninja-tower-1.0\", line 4, in <module
File "D:\tmp\_pyweek10_previa\ninja-tower-1.0\gamelib\", line 798, in m
game = Game()
File "D:\tmp\_pyweek10_previa\ninja-tower-1.0\gamelib\", line 72, in __
File "D:\tmp\_pyweek10_previa\ninja-tower-1.0\gamelib\", line 96, in st
self.instructions = [sprite(x.split('/')[-1]) for x in sorted(glob.glob('dat
File "D:\tmp\_pyweek10_previa\ninja-tower-1.0\gamelib\", line 36, in sp
imagecache[imagename, flip_x] = pyglet.resource.image(imagename, flip_x=flip
File "D:\hg_externals\pyglet\pyglet\", line 500, in image
identity = self._cached_images[name] = self._alloc_image(name)
File "D:\hg_externals\pyglet\pyglet\", line 443, in _alloc_image
file = self.file(name)
File "D:\hg_externals\pyglet\pyglet\", line 399, in file
raise ResourceNotFoundException(name)
pyglet.resource.ResourceNotFoundException: Resource "data\instructions-first-1.p
ng" was not found on the path. Ensure that the filename has the correct captial
This is due to pyglet liking unix style paths with resources, and that glob is polite and returns OS specific paths. A fix for this (tested with your code, also the globx workaround worked with multiple OSes in other pyweek):
Add the utility function globx somewhere in
import os, glob
# must return unix style paths, which is what pyglet.resources expects
def globx(s):
    if os.sep == '\\':
        s = s.replace('/',os.sep)
    li = glob.glob(s)
    if os.sep == '\\':
        li = [ s.replace('\\','/') for s in li ]
return li
and replace in your, class Game

def startinstructions(self):
    self.instructions = [sprite(x.split('/')[-1]) for x in sorted(glob.glob('data/instructions*.png'))]


def startinstructions(self):
      self.instructions = [sprite(x.split('/')[-1]) for x in sorted(globx('data/instructions*.png'))]

With these the game launches, and you can get to the level screen.

But shortly after start the level I pressed key '1' (one) and got:

Traceback (most recent call last):
File "D:\tmp\_pyweek10_previa\ninja-tower-1.0\", line 4, in <module
File "D:\tmp\_pyweek10_previa\ninja-tower-1.0\gamelib\", line 811, in m
File "D:\tmp\_pyweek10_previa\ninja-tower-1.0\gamelib\", line 127, in s
File "D:\hg_externals\pyglet\pyglet\app\", line 123, in run
File "D:\hg_externals\pyglet\pyglet\app\", line 133, in run
File "D:\hg_externals\pyglet\pyglet\app\", line 161, in _run_estimated
timeout = self.idle()
File "D:\hg_externals\pyglet\pyglet\app\", line 276, in idle
File "D:\hg_externals\pyglet\pyglet\window\", line 1150, in dispatc
if EventDispatcher.dispatch_event(self, *args) != False:
File "D:\hg_externals\pyglet\pyglet\", line 358, in dispatch_event
self._raise_dispatch_exception(event_type, args, handler)
File "D:\hg_externals\pyglet\pyglet\", line 355, in dispatch_event
if handler(*args):
File "D:\tmp\_pyweek10_previa\ninja-tower-1.0\gamelib\", line 61, in on
File "D:\tmp\_pyweek10_previa\ninja-tower-1.0\gamelib\", line 133, in d
File "D:\tmp\_pyweek10_previa\ninja-tower-1.0\gamelib\", line 806, in d
File "D:\tmp\_pyweek10_previa\ninja-tower-1.0\gamelib\", line 623, in d
glColor3f(0, 0, 0, 255)
TypeError: this function takes 3 arguments (4 given)

That should be trivial to fix, but I must go work.
Thanks so much Claxo! I've uploaded a bugfix release and updated the links above.

(What sort of a weird glColor3f() do I have that was happy with four arguments?!)
It segfaults for me after a few seconds. No traceback or anything. I'm on Ubuntu. Any ideas?
Kill the sound, that seems to be the way for other games.

Unfortunately there's no global variable to flip to turn it off, but if you remove all the'something.ogg').play() lines that will kill the sound effects and then you're left with the music. If it still crashes you can try removing the music parts in the Game class.

Sorry for the lack of testing and thanks for trying to get it work!
Also make sure you have the latest pyglet (1.1.4). I forgot to bundle it with the game.