Beispiel #1
0
    def activate(self):
        GameState.activate(self)

        w, h = sd.get_size()

        self.cr_open = scale(res.loadImage("open.png", 0, 1), (20,30))
        self.cr_grasp = scale(res.loadImage("grasp.png", 0, 1), (20, 25))
        self.cr_arrow = res.loadImage("next_arrow.png", 0, 1)

        self.cr = KeyCursor(self.cr_open)
        self.cr_state = HAND_OPEN

        self.cr_bounds = Rect(0,0,w,h).inflate(-w*.2, -h*.2)
        self.cr_bounds.height -= 30
        self.cr_bounds.width -= 20
        self.cr_pos = list(self.cr_bounds.center)
        self.cr_speed = 0
        self.cr.enable()

        self.map_pos = self.cr_pos[:]

        path = res.mapPath("overworld3.tmx")

        self.tilemap = BufferedTilemapRenderer(path,
                       (w,h), force_colorkey=(128,0,63))

        self.camera = OverworldCamera([], self.tilemap, ((0,0), (w,h)))
        self.camera.center(self.cr_pos)
        self.tilemap.redraw()


        self.cleared = 0
Beispiel #2
0
    def activate(self):
        GameState.activate(self)

        w, h = sd.get_size()

        self.cr_open = scale(res.loadImage("open.png", 0, 1), (20, 30))
        self.cr_grasp = scale(res.loadImage("grasp.png", 0, 1), (20, 25))
        self.cr_arrow = res.loadImage("next_arrow.png", 0, 1)

        self.cr = KeyCursor(self.cr_open)
        self.cr_state = HAND_OPEN

        self.cr_bounds = Rect(0, 0, w, h).inflate(-w * .2, -h * .2)
        self.cr_bounds.height -= 30
        self.cr_bounds.width -= 20
        self.cr_pos = list(self.cr_bounds.center)
        self.cr_speed = 0
        self.cr.enable()

        self.map_pos = self.cr_pos[:]

        path = res.mapPath("overworld3.tmx")

        self.tilemap = BufferedTilemapRenderer(path, (w, h),
                                               force_colorkey=(128, 0, 63))

        self.camera = OverworldCamera([], self.tilemap, ((0, 0), (w, h)))
        self.camera.center(self.cr_pos)
        self.tilemap.redraw()

        self.cleared = 0
Beispiel #3
0
    def __init__(self, party, enemies):
        GameState.__init__(self)

        self.bkg = gfx.load("misc/overpass.png")
        self.bkg = pygame.transform.scale(self.bkg, (sd.get_size()))

        self.actors = []
        self.glitter = []

        hero = lib2d.sheetloader.load_actor("hero", Hero)
        hero.avatar.play("walk")
        hero.face("north")
        self.actors.append(hero)

        m0 = Monster()
        m0.render()

        m0.rect.topleft = (170, 10)  # hack

        party = [hero]
        enemies = [m0]

        self.timer = VisualTimer(0, (10, 30, 100, 16))
        self.player_area = Rect(160, 140, 160, 78)
        self.party = [party, enemies]
        self.member_focus = 0

        self.stale_spells = []

        # kinda a hack until [if] i properly implement a scheduler for
        # concurrent states
        self.states = []
        self.substate = None
Beispiel #4
0
 def __init__(self, text, choices, title=None):
     GameState.__init__(self)
     self.text = text
     self.state = 0
     self.counter = 0
     self.title = title
     self.choices = choices
Beispiel #5
0
 def __init__(self, area, startPosition=None):
     GameState.__init__(self)
     self.area = area
     self.heroOnExit = False         # use this flag when warping
     self.background = (203, 204, 177)
     self.foreground = (0, 0, 0)
     self.blank = True
Beispiel #6
0
    def __init__(self, party, enemies):
        GameState.__init__(self)

        self.bkg = gfx.load("misc/overpass.png")
        self.bkg = pygame.transform.scale(self.bkg, (sd.get_size()))

        self.actors = []
        self.glitter = []

        hero = lib2d.sheetloader.load_actor("hero", Hero)
        hero.avatar.play("walk")
        hero.face("north")
        self.actors.append(hero)

        m0 = Monster()
        m0.render()

        m0.rect.topleft = (170, 10)   # hack

        party = [hero]
        enemies = [m0]

        self.timer = VisualTimer(0, (10,30,100,16))
        self.player_area = Rect(160, 140, 160, 78)
        self.party = [party, enemies]
        self.member_focus = 0

        self.stale_spells = []

        # kinda a hack until [if] i properly implement a scheduler for
        # concurrent states
        self.states = []
        self.substate = None
Beispiel #7
0
    def activate(self):
        GameState.activate(self)

        # this is hack, for sure, but ensure our music will start
        # playing if we are being transition'd from another state

        if self.dialogs[-1][:6] == "#music":
            text = self.dialogs.pop()
            tag, path = text.split(":")
            #res.playMusic(path, loops=-1)
        
        self.cleared = False
Beispiel #8
0
    def __init__(self, path):
        GameState.__init__(self)

        self.dialogs = []

        with open(path) as fh:
            for line in fh:
                line = line.strip()
                if line != "":
                    self.dialogs.append(line)

        self.dialogs.reverse()

        self.queue_image = None
        self.queue_music = None
        self.queue_dialog = None
Beispiel #9
0
 def deactivate(self):
     GameState.deactivate(self)
Beispiel #10
0
 def __init__(self, parent):
     GameState.__init__(self)
     self.stack = deque()
     self.parent = parent
     self.history = defaultdict(int)
     self.last_selection = defaultdict(int)
Beispiel #11
0
 def __init__(self, parent, stack):
     GameState.__init__(self)
     self.parent = parent
     self.stack = stack
Beispiel #12
0
 def reactivate(self):
     GameState.reactivate(self)
     self.cleared = False
Beispiel #13
0
 def __init__(self, text, title=None):
     GameState.__init__(self)
     self.font = "dpcomic.ttf"
     self.text = text
     self.title = title
     self.blank = True
Beispiel #14
0
 def __init__(self, area, startPosition=None):
     GameState.__init__(self)
     self.area = area
     global state
     state = self
Beispiel #15
0
 def __init__(self, driver, worldmap):
     GameState.__init__(self, driver)
Beispiel #16
0
 def __init__(self, parent, stack):
     GameState.__init__(self)
     self.parent = parent
     self.stack = stack
Beispiel #17
0
 def __init__(self, parent, area, startPosition=None):
     GameState.__init__(self, parent)
     self.area = area
Beispiel #18
0
 def __init__(self, parent):
     GameState.__init__(self)
     self.stack = deque()
     self.parent = parent
     self.history = defaultdict(int)
     self.last_selection = defaultdict(int)
Beispiel #19
0
 def deactivate(self):
     GameState.deactivate(self)
     res.fadeoutMusic()
Beispiel #20
0
 def __init__(self, map_name=None):
     GameState.__init__(self)
     self.map_name = map_name
Beispiel #21
0
 def __init__(self, map_name=None):
     GameState.__init__(self)
     self.map_name = map_name
Beispiel #22
0
 def deactivate(self):
     GameState.deactivate(self)