def __init__(self, jsonData, center=None):
      displayname = jsonData['displayname']
      spritename = jsonData['spritename']

      PlayerCharacter.__init__(self, spritename, displayname, center)
      
      BattleGroup.__init__(self, [load_player(name) for name in jsonData['members']])
Beispiel #2
0
 def __init__(self):
   Scene.__init__(self)
   self._screen = Screen()
   self._player = PlayerCharacter()
   self._floor = CurrentFloor()
   self._sight = Sight(self._player)
   self._floor.put_monster(Monster())
Beispiel #3
0
class DungeonScene(Scene):
  def __init__(self):
    Scene.__init__(self)
    self._screen = Screen()
    self._player = PlayerCharacter()
    self._floor = CurrentFloor()
    self._sight = Sight(self._player)
    self._floor.put_monster(Monster())

  def initialize(self):
    self._screen.clear()

  def update(self):
    self._floor.update_monsters()
    self.draw()
    self.control(self._screen.read_key())

  def control(self, key):
    if   key == 'l': self.walk_player(Direction.EAST)
    elif key == 'h': self.walk_player(Direction.WEST)
    elif key == 'k': self.walk_player(Direction.NORTH)
    elif key == 'j': self.walk_player(Direction.SOUTH)
    elif key == 'y': self.walk_player(Direction.NORTH_WEST)
    elif key == 'u': self.walk_player(Direction.NORTH_EAST)
    elif key == 'b': self.walk_player(Direction.SOUTH_WEST)
    elif key == 'n': self.walk_player(Direction.SOUTH_EAST)
    elif key == '>': self.down_stairs()

  def walk_player(self, direction):
    self._floor.walk_character(direction, self._player)

  def down_stairs(self):
    if not self._floor.is_down_stairs_at(self._player.position()):
      return
    if not self._floor.is_last_floor():
      self._floor.next()
      self._screen.clear()
    else:
      GameScene.change(EndingScene())

  def draw(self):
    self._sight.draw(self._screen)
    self._player.draw(self._screen)
Beispiel #4
0
    for index, filename in enumerate(saves, 1):
        print("{}) {}".format(index, filename))
    choice = int(input("Choose : ")) - 1
    if choice == -1:
        new_game = True
    else:
        hero = save_game.load_save(saves[choice])
else:
    new_game = True

if new_game:
    player_name = input("Enter your name: ")
    character_name = input("Enter your hero's name: ")
    hero = PlayerCharacter(character_name,
                           races.Human,
                           "hero",
                           player_name,
                           catch_phrase="Go beyond! Plus Ultra!")
    hero.sayHello()

print("Welcome to the game %s" % (hero.player_name))

villan = Enemy("Nomu", races.Human, "villan", catch_phrase="...")

while True:

    villan.sayHello()

    while True:
        if hero.hp > 0:
            hero.choose_action(villan)
   def __init__(self, jsonData, center=None):
      displayname = jsonData['charactername']
      spritename = jsonData['spritename']

      PlayerCharacter.__init__(self, spritename, displayname, center)
      BattleableCharacter.__init__(self, jsonData)