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)

Comments

in windows xp
At 1st got a traceback:

D:\tmp\_pyweek10_previa\ninja-tower-1.0>run_game.py
Traceback (most recent call last):
File "D:\tmp\_pyweek10_previa\ninja-tower-1.0\run_game.py", line 4, in <module
>
main.main()
File "D:\tmp\_pyweek10_previa\ninja-tower-1.0\gamelib\main.py", line 798, in m
ain
game = Game()
File "D:\tmp\_pyweek10_previa\ninja-tower-1.0\gamelib\main.py", line 72, in __
init__
self.startinstructions()
File "D:\tmp\_pyweek10_previa\ninja-tower-1.0\gamelib\main.py", line 96, in st
artinstructions
self.instructions = [sprite(x.split('/')[-1]) for x in sorted(glob.glob('dat
a/instructions*.png'))]
File "D:\tmp\_pyweek10_previa\ninja-tower-1.0\gamelib\main.py", line 36, in sp
rite
imagecache[imagename, flip_x] = pyglet.resource.image(imagename, flip_x=flip
_x)
File "D:\hg_externals\pyglet\pyglet\resource.py", line 500, in image
identity = self._cached_images[name] = self._alloc_image(name)
File "D:\hg_externals\pyglet\pyglet\resource.py", line 443, in _alloc_image
file = self.file(name)
File "D:\hg_externals\pyglet\pyglet\resource.py", 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
isation
 
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 main.py
 
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 main.py, class Game

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

with

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:

 D:\tmp\_pyweek10_previa\ninja-tower-1.0>run_game.py
Traceback (most recent call last):
File "D:\tmp\_pyweek10_previa\ninja-tower-1.0\run_game.py", line 4, in <module
>
main.main()
File "D:\tmp\_pyweek10_previa\ninja-tower-1.0\gamelib\main.py", line 811, in m
ain
game.start()
File "D:\tmp\_pyweek10_previa\ninja-tower-1.0\gamelib\main.py", line 127, in s
tart
pyglet.app.run()
File "D:\hg_externals\pyglet\pyglet\app\__init__.py", line 123, in run
event_loop.run()
File "D:\hg_externals\pyglet\pyglet\app\base.py", line 133, in run
self._run_estimated()
File "D:\hg_externals\pyglet\pyglet\app\base.py", line 161, in _run_estimated
timeout = self.idle()
File "D:\hg_externals\pyglet\pyglet\app\base.py", line 276, in idle
window.dispatch_event('on_draw')
File "D:\hg_externals\pyglet\pyglet\window\__init__.py", line 1150, in dispatc
h_event
if EventDispatcher.dispatch_event(self, *args) != False:
File "D:\hg_externals\pyglet\pyglet\event.py", line 358, in dispatch_event
self._raise_dispatch_exception(event_type, args, handler)
File "D:\hg_externals\pyglet\pyglet\event.py", line 355, in dispatch_event
if handler(*args):
File "D:\tmp\_pyweek10_previa\ninja-tower-1.0\gamelib\main.py", line 61, in on
_draw
self.draw()
File "D:\tmp\_pyweek10_previa\ninja-tower-1.0\gamelib\main.py", line 133, in d
raw
self.building.draw()
File "D:\tmp\_pyweek10_previa\ninja-tower-1.0\gamelib\main.py", line 806, in d
raw
rope.draw()
File "D:\tmp\_pyweek10_previa\ninja-tower-1.0\gamelib\main.py", line 623, in d
raw
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 pyglet.resource.media('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.