[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[pygame] A question about callback functions
- To: pygame-users@xxxxxxxx
- Subject: [pygame] A question about callback functions
- From: mike@xxxxxxxxx
- Date: Mon, 29 Aug 2005 05:45:46 -0700 (PDT)
- Delivered-to: archiver@seul.org
- Delivered-to: pygame-users-outgoing@seul.org
- Delivered-to: pygame-users@seul.org
- Delivery-date: Mon, 29 Aug 2005 08:46:31 -0400
- Importance: Normal
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
- User-agent: SquirrelMail/1.4.4
I am relatively new to Python/Pygame and I love it so far! Coming from a
C/C++ background, Python is breath of fresh air :)
I am creating a simple tile-based arcade game using Pygame. As part of the
project I want to have enemy sprites on the board who run their AI
routines from separate scripts. I want this to be modular so users can
drop their own AI scripts into a folder, modify the appropriate ini file,
and then run the game which loads the AI scripts automatically and assigns
them to the proper enemy.
Using C, I would have probably implemented a system using function
pointers to create callbacks but Python doesn't seem to have such
functionality. What techniques would anyone else suggest to implement such
a feature in 'pure' Python?