Archive for events

Ok, NOW there’s a world out there

Posted in code with tags , on July 30, 2008 by Tau

The issue I had with changing maps has been resolved. For some reason, the map would overwrite but the events would append. I don’t understand why, and if anyone can explain I’d be grateful (I think it may have something to do with the new event list being defined in the event constructor, and the map not. But it wouldn’t work otherwise, again, I don’t understand why). So I just delete all the events in the list before writing a new one. Now it works fine, and all new maps and their events can be read in from a file, and moved between. That means I don’t have to write more code for a new map, conversations or events. The sky’s the limit.

Advertisements

There’s a whole world out there

Posted in code with tags , , on July 28, 2008 by Tau

Another event type added: this one changed the map and curret list of active events. So it’d be used for going from a worldmap to a village, a village to a house etc.

No, wait, it doesn’t work. For some reason the map overwrites but the eventlist appends, so all of the previous map’s events are still active in the new one.

Ok. I’m sure there’s a rational explanation for this…

Reading in Events

Posted in code with tags , on July 27, 2008 by Tau

Mmm, I love persistancy….ugh. But it has to be done; it’s just not good to have numbers and strings defined in your code, with lots of if statements. So I’ve set the list of events to read in my a file. So this isn’t persistancy as such, but at some point things will need to be written to file for the save games. Next I need to write a sub-routine which sets up the current environment by reading in the map and list of events. Something like:

ChangeWorld(map, events):

newevents = ReadFile(events)

newmap = ReadFile(map)

return newevents, newmap

I guess this would first be called by the initial menu screen, which sets the gameloop attributes map and eventlist, and then called again by the event class whenever the player changed location. It’ll have to be defined within the event class, in this case.