Automating Game Events

One of the major things that’s been bothering me about the code as I look it over is the amount of hardcoded strings, and the requirement for data files to have a certain format. Previously, the events listed in the maps had to have two arguments because when the list of events was created in memory, both arg1 and arg2 had to be set (there would be an error that the input array was out of range without them) which lead to lots of NULLs in the map files.

I’ve altered this. Now the arguments for game events are filled into an array, rather than private variables, so that any number of arguments may be given. This is also advantageous as future event classes may need more than two arguments.

This being an RPG, there’s going to be a need to automate events; those wonderful parts of the game where the story runs off and the player has to do nothing but press ‘continue’ when they’ve finished reading. So I’ve started a class to manage this. All it does is execute an event, and then wait a given time before executing the next one. This is done with the pygame.time.delay() function. Something like:

for i in range(len(events)):

Although, it’s not finished yet. All the current events have player cancelling built in (like a conversation won’t end until you press ‘q’) which I’ll keep for the time being. Some people read slower than others..

I expect some form of this will be used for the non-player movement on screen eg. village people wandering around. That may be the next area of work for me, although I have started to think about the battle handling. Clearly though, an intensive graphics session is needed.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: