def __init__(self): print("LINK START") self.textObj = SMText() self.textObj.addText("test", "abom20141216") self.audioMgr = SMAudioManager() #Print out Logo self.title = OnscreenImage(image="../res/icons/logo.png", pos=(0.0, -70.0, 0.45), scale=(1.1, 0.9, 0.5)) #Allow Transparencies of PNG self.title.setTransparency(TransparencyAttrib.MAlpha) self.continueBtn = DirectButton(text="New Game", scale=0.1, command=self.newGame) self.newBtn = DirectButton(text="Continue Game", scale=0.1, command=self.continueGame) self.newBtn.setPos(0.0, 0.0, -0.2) self.quitBtn = DirectButton(text="Quit", scale=0.1, command=self.quitGame) self.quitBtn.setPos(0.0, 0.0, -0.4) self.accept('escape', base.userExit)
class Game(DirectObject): def __init__(self): print("LINK START") self.textObj = SMText() self.textObj.addText("test", "abom20141216") self.audioMgr = SMAudioManager() #Print out Logo self.title = OnscreenImage(image = "../res/icons/logo.png", pos = (0.0, -70.0, 0.45), scale = (1.1, 0.9, 0.5)) #Allow Transparencies of PNG self.title.setTransparency(TransparencyAttrib.MAlpha) self.continueBtn = DirectButton(text = "New Game", scale = 0.1, command = self.newGame) self.newBtn = DirectButton(text = "Continue Game", scale= 0.1, command = self.continueGame) self.newBtn.setPos(0.0, 0.0, -0.2) self.quitBtn = DirectButton(text = "Quit", scale = 0.1, command = self.quitGame) self.quitBtn.setPos(0.0, 0.0, -0.4) self.accept('escape', base.userExit) def newGame(self): self.hideMenu() # Loading screen loadingText=OnscreenText("Loading...",1,fg=(1,1,1,1),pos=(0,0),align=TextNode.ACenter,scale=.07,mayChange=1) base.graphicsEngine.renderFrame() base.graphicsEngine.renderFrame() base.graphicsEngine.renderFrame() base.graphicsEngine.renderFrame() self.world = SMWorld(1, self.textObj, self.audioMgr) loadingText.cleanup() def continueGame(self): # When saving game state is implemented it will be added here. print("Continue Game") def quitGame(self): base.userExit() def hideMenu(self): self.title.hide() self.newBtn.hide() self.continueBtn.hide() self.quitBtn.hide() def showMenu(self): self.title.show() self.newBtn.show() self.continueBtn.show() self.quitBtn.show()
def __init__(self): print("LINK START") self.textObj = SMText() self.textObj.addText("test", "abom20141216") self.audioMgr = SMAudioManager() #Print out Logo self.title = OnscreenImage(image = "../res/icons/logo.png", pos = (0.0, -70.0, 0.45), scale = (1.1, 0.9, 0.5)) #Allow Transparencies of PNG self.title.setTransparency(TransparencyAttrib.MAlpha) self.continueBtn = DirectButton(text = "New Game", scale = 0.1, command = self.newGame) self.newBtn = DirectButton(text = "Continue Game", scale= 0.1, command = self.continueGame) self.newBtn.setPos(0.0, 0.0, -0.2) self.quitBtn = DirectButton(text = "Quit", scale = 0.1, command = self.quitGame) self.quitBtn.setPos(0.0, 0.0, -0.4) self.accept('escape', base.userExit)
class Game(DirectObject): def __init__(self): print("LINK START") self.textObj = SMText() self.textObj.addText("test", "abom20141216") self.audioMgr = SMAudioManager() #Print out Logo self.title = OnscreenImage(image="../res/icons/logo.png", pos=(0.0, -70.0, 0.45), scale=(1.1, 0.9, 0.5)) #Allow Transparencies of PNG self.title.setTransparency(TransparencyAttrib.MAlpha) self.continueBtn = DirectButton(text="New Game", scale=0.1, command=self.newGame) self.newBtn = DirectButton(text="Continue Game", scale=0.1, command=self.continueGame) self.newBtn.setPos(0.0, 0.0, -0.2) self.quitBtn = DirectButton(text="Quit", scale=0.1, command=self.quitGame) self.quitBtn.setPos(0.0, 0.0, -0.4) self.accept('escape', base.userExit) def newGame(self): self.hideMenu() # Loading screen loadingText = OnscreenText("Loading...", 1, fg=(1, 1, 1, 1), pos=(0, 0), align=TextNode.ACenter, scale=.07, mayChange=1) base.graphicsEngine.renderFrame() base.graphicsEngine.renderFrame() base.graphicsEngine.renderFrame() base.graphicsEngine.renderFrame() self.world = SMWorld(1, self.textObj, self.audioMgr) loadingText.cleanup() def continueGame(self): # When saving game state is implemented it will be added here. print("Continue Game") def quitGame(self): base.userExit() def hideMenu(self): self.title.hide() self.newBtn.hide() self.continueBtn.hide() self.quitBtn.hide() def showMenu(self): self.title.show() self.newBtn.show() self.continueBtn.show() self.quitBtn.show()