Re: Another question again, still Python, yea?

Right, the reason I asked was because I can't imagine the amount of classes and or level entries a game like Paladin has. If you haven't played it in a nutshell it is an RPG where you follow different quest objectives while moving across multiple maps with different enemies. Still. One thing at a time.
I just considered another way we could do the leveling concept, though this one is a much less concrete idea. Here's the theoretical code.

class level_handler:
 def __init__(self):
  self.win_conditions = {} #Store what is required to win
 def update_data(self, conditions):
  self.win_conditions = conditions
#To use this, we could do something like so.
lv = level_handler()
level_data = ({"alive", 0},)
lv.update_data(level_data[0])
#Pretend that we have the player class and enemy list from post 1 again. Here is what the main loop could look like:
while 1:
 level_logic()

def level_logic():
 for i in lv.win_conditions.items():
  if i[0] == "alive" and len(enemies) == i[1]:
   #We won the level, so let's advance.
   #Please note, player.level is currently at 0, or it would be in a program if I wish to use this technique
   player.level += 1
   lv.update_data(level_data[player.level]) #This will crash if you run this right now because we don't have a second item, but you get the point

So, yeah. Any issues you see with this approach? The downside to this from what I can gather is that I would have to teach the interpreter what each entry means, but I feel like that is going to be there no matter what I go with. I store the level_data as a tuple because I don't see it changing throughout the game, but if I'm ever going to allow user-created content (Most likely not) I would be in trouble. I could also create map_data which is just like level_data except it will hold information pertaining to that level's map. Thoughts?

-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
  • ... AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Hijacker via Audiogames-reflector

Reply via email to