Spielend programmieren lernen

Programmierkurse für Kinder, Jugendliche und Erwachsene

User Tools

Site Tools



  • date 2012-08-14 18:32
  • author Horst JENS
  • tags code, ThePythonGameBook
  • slug 20120814_pycrawl_monsterdemo

On my work for an python rogue-like game pycrawl ( part of my ThePythonGameBook project ) i managed to create another workable demo:

see it on githup: pycrawl-monsterdemo.py

The monsterdemo, while improving the code for the level class, focus on animating Monsters (M). The monsters have a little state machine (moods) and loose energy when moving around too much. If the energy level of each individual monster is too low, it goes to sleep (Z) for a while, until it runs around again. In the animatied gif above, you can see ho the Z is changing into M and vice versa.

[caption id=“attachment_528” align=“aligncenter” width=“480”]image0 pycrawl-monsterdemo.py notice the changing state of the monsters ( M ) between awake and sleeping ( Z )[/caption]

On my research for this project, i made a google seach for “python” and “rogue like game” and found this excellent tutorial. The tutorial gave me already valuable insight into room and level creation ( i will have to make a new mapmakingdemo ) and i look forward to play around with the libtcod module. As far as i understand from the tutorial, libtcod does not only provide colored text output for rogue-like games but also many other important features like line-of-sight and field-of-view calculation.

I also feel that it would be a good idea to seperate stackable items ( that can be moved around, like loot, keys, gems, swords etc. ) from Monsters ( who move around self-propelled ) and walls ( non-moving). I have to make an itemdemo next and a levelgeneratordemo.

/var/www/horst/spielend-programmieren.at/data/pages/en/blog/2012/0814_pycrawl_monsterdemo.txt · Last modified: 2017/10/12 09:43 (external edit)