예제 #1
0
파일: overworld.py 프로젝트: MacLeek/mh
    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
예제 #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
예제 #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
예제 #4
0
파일: dialog.py 프로젝트: bitcraft/lpc1
 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
예제 #5
0
파일: worldstate.py 프로젝트: bitcraft/mh
 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
예제 #6
0
파일: battlestate.py 프로젝트: MacLeek/mh
    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
예제 #7
0
파일: cutscene.py 프로젝트: bitcraft/mh
    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
예제 #8
0
파일: cutscene.py 프로젝트: bitcraft/mh
    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
예제 #9
0
파일: overworld.py 프로젝트: MacLeek/mh
 def deactivate(self):
     GameState.deactivate(self)
예제 #10
0
파일: battlestate.py 프로젝트: MacLeek/mh
 def __init__(self, parent):
     GameState.__init__(self)
     self.stack = deque()
     self.parent = parent
     self.history = defaultdict(int)
     self.last_selection = defaultdict(int)
예제 #11
0
파일: battlestate.py 프로젝트: MacLeek/mh
 def __init__(self, parent, stack):
     GameState.__init__(self)
     self.parent = parent
     self.stack = stack
예제 #12
0
파일: cutscene.py 프로젝트: bitcraft/mh
 def reactivate(self):
     GameState.reactivate(self)
     self.cleared = False
예제 #13
0
파일: dialog.py 프로젝트: bitcraft/lpc1
 def __init__(self, text, title=None):
     GameState.__init__(self)
     self.font = "dpcomic.ttf"
     self.text = text
     self.title = title
     self.blank = True
예제 #14
0
 def __init__(self, area, startPosition=None):
     GameState.__init__(self)
     self.area = area
     global state
     state = self
예제 #15
0
 def __init__(self, driver, worldmap):
     GameState.__init__(self, driver)
예제 #16
0
 def __init__(self, parent, stack):
     GameState.__init__(self)
     self.parent = parent
     self.stack = stack
예제 #17
0
파일: levelstate.py 프로젝트: bitcraft/lpc1
 def __init__(self, parent, area, startPosition=None):
     GameState.__init__(self, parent)
     self.area = area
예제 #18
0
 def __init__(self, parent):
     GameState.__init__(self)
     self.stack = deque()
     self.parent = parent
     self.history = defaultdict(int)
     self.last_selection = defaultdict(int)
예제 #19
0
파일: cutscene.py 프로젝트: bitcraft/mh
 def deactivate(self):
     GameState.deactivate(self)
     res.fadeoutMusic()
예제 #20
0
 def __init__(self, map_name=None):
     GameState.__init__(self)
     self.map_name = map_name
예제 #21
0
파일: overworld.py 프로젝트: MacLeek/mh
 def __init__(self, map_name=None):
     GameState.__init__(self)
     self.map_name = map_name
예제 #22
0
 def deactivate(self):
     GameState.deactivate(self)