def startMenu(): py.init() v.screen = py.display.set_mode((920, 630), py.DOUBLEBUF) buttons = py.sprite.Group() buttons.add(mapMenuItems.button("New Map", (460, 270), 50, (255, 255, 0), (0, 0, 255), "../Resources/Fonts/RunicSolid.ttf", "NM", True, (220, 50))) buttons.add(mapMenuItems.button("Load Map", (460, 360), 50, (255, 255, 0), (0, 0, 255), "../Resources/Fonts/RunicSolid.ttf", "LM", True, (220, 50))) texts = py.sprite.Group() texts.add(mapMenuItems.textLabel("Legend Of Aiopa RPG", (460, 150), (255, 0, 255), "../Resources/Fonts/RunicSolid.ttf", 50, variable = False, centred = True)) texts.add(mapMenuItems.textLabel("Map Editor", (460, 200), (200, 0, 200), "../Resources/Fonts/RunicSolid.ttf", 40, variable = False, centred = True)) v.textNum = 1 while True: py.event.pump() v.events = [] v.events = py.event.get() v.screen.fill((0, 255, 255)) texts.update() buttons.update() py.display.flip() for event in v.events: if event.type == py.MOUSEBUTTONDOWN: for b in buttons: if b.pressed(): if b.ID == "NM": #setup() npcEdit.createNPC() if b.ID == "LM": from sys import path path.append('../Saves') import mapFile # @UnresolvedImport v.totalMap = mapFile.map load()
def update(self): if self.type == "layer": self.state = v.eLayer if v.eLayer == "base": self.image = self.image1 else: self.image = self.image2 if self.rect.collidepoint((py.mouse.get_pos()[0], py.mouse.get_pos()[1] - 550)): for event in v.events: if event.type == py.MOUSEBUTTONDOWN: if v.eLayer == "base": v.eLayer = "top" else: v.eLayer = "base" if self.type == "hitbox": self.state = v.editHitable if v.editHitable == False: self.image = self.image1.copy() self.image.fill((100, 100, 100), special_flags=py.BLEND_RGBA_MULT) else: self.image = self.image1 if v.eLayer == "base": if self.rect.collidepoint((py.mouse.get_pos()[0], py.mouse.get_pos()[1] - 550)): for event in v.events: if event.type == py.MOUSEBUTTONDOWN: v.editHitable = not v.editHitable else: self.image.fill((50, 50, 50), special_flags=py.BLEND_RGBA_MULT) if self.type == "over": self.state = v.overPlayer if v.overPlayer: self.image = self.image1.copy() else: self.image = self.image2.copy() if v.eLayer == "top": if self.rect.collidepoint((py.mouse.get_pos()[0], py.mouse.get_pos()[1] - 550)): for event in v.events: if event.type == py.MOUSEBUTTONDOWN: v.overPlayer = not v.overPlayer else: self.image.fill((50, 50, 50), special_flags=py.BLEND_RGBA_MULT) if self.type == "teleport": self.state = v.makeTeleport if v.makeTeleport == False: self.image = self.image1.copy() self.image.fill((100, 100, 100), special_flags=py.BLEND_RGBA_MULT) else: self.image = self.image1 if v.eLayer == "top": if self.rect.collidepoint((py.mouse.get_pos()[0], py.mouse.get_pos()[1] - 550)): for event in v.events: if event.type == py.MOUSEBUTTONDOWN: v.makeTeleport = not v.makeTeleport else: self.image.fill((50, 50, 50), special_flags=py.BLEND_RGBA_MULT) if self.type == "enemy": self.state = v.makeEnemy if v.makeEnemy == False: self.image = self.image1.copy() self.image.fill((100, 100, 100), special_flags=py.BLEND_RGBA_MULT) else: self.image = self.image1 if v.eLayer == "top": if self.rect.collidepoint((py.mouse.get_pos()[0], py.mouse.get_pos()[1] - 550)): for event in v.events: if event.type == py.MOUSEBUTTONDOWN: v.makeEnemy = not v.makeEnemy else: self.image.fill((50, 50, 50), special_flags=py.BLEND_RGBA_MULT) if self.type == "npc": self.state = False self.image = self.image1.copy() if v.eLayer == "top": if self.rect.collidepoint((py.mouse.get_pos()[0], py.mouse.get_pos()[1] - 550)): for event in v.events: if event.type == py.MOUSEBUTTONDOWN: npcEdit.createNPC() else: self.image.fill((50, 50, 50), special_flags=py.BLEND_RGBA_MULT) if self.rect.collidepoint((py.mouse.get_pos()[0], py.mouse.get_pos()[1] - 550)): py.draw.rect(v.options, (200, 200, 0), self.rect) v.publicState = self.state self.labels.update() self.labels.draw(v.options) else: py.draw.rect(v.options, (200, 200, 200), self.rect) py.draw.rect(v.options, (0, 0, 0), self.rect, 2) v.options.blit(self.image, self.rect)