Example #1
0
 def showCredits(self):
     self.levelpack_finished = True
     if not self.enable_credits:
         self.sound.stopSounds()
         self.running = False
     SHOWCOUNT = 400
     showcount = SHOWCOUNT
     line = 0
     hcount = 0
     SPACE = 60
     lastTime = jngl.getTime()
     timePerStep = 0.01
     credits = [["Programming", "Jannik Waschkau", "Jan-Niklas Hasse", "Kolja Lubitz", "Carsten Pfeffer"],
         ["Leveldesign", "Jannik Waschkau", "Jan-Niklas Hasse", "Kolja Lubitz"],
         ["Graphics", "Carsten Pfeffer", "Kolja Lubitz","Jan-Niklas Hasse"],
         ["Music & Sound","Jannik Waschkau"],
         ["Graphics Engine (JNGL)","Jan-Niklas Hasse"],
         ["Thanks to","Hendrik Leibrandt","Malte 'MonkZ' Kuhn","Anika 'Chibi' Roosch","University Bremen"],
         ["Thanks to","Adrian Lubitz","Jannis Tanner"]]
     jngl.swapBuffers()
     jngl.translate(-jngl.getScreenWidth()/2, -jngl.getScreenHeight()/2)
     jngl.updateInput()
     jngl.setFontSize(50)
     while self.running:
         if jngl.getTime() - lastTime > timePerStep:
             lastTime += timePerStep
             jngl.setFontSize(50)
             for i in range(0, 3):
                 jngl.draw(RESOURCEWORLD + "Background.png", i*jngl.getWidth(RESOURCEWORLD + "Background.png"), 0)
             if line >= len(credits):
                 jngl.print("Thanks for Playing!!!", int((self.windowWidth/2) - jngl.getTextWidth("Thanks for Playing") / 2), (self.windowHeight/2))
                 self.levelpack_finished = True
                 if jngl.keyPressed(jngl.key.Any):
                     self.sound.stopSounds()
                     self.running = False
             elif jngl.keyPressed(jngl.key.Any):
                 line +=1
             else:
                 for word in credits[line]:
                     jngl.print(word, int((self.windowWidth/2) - jngl.getTextWidth(word) / 2), (self.windowHeight/2)-150+SPACE*hcount)
                     hcount += 1
                 hcount = 0
                 showcount-=1
                 if not showcount:
                     line+=1
                     showcount = SHOWCOUNT
             jngl.setFontSize(20)
             jngl.print("www.somyeol.com", self.windowWidth-180, self.windowHeight-30)
             jngl.swapBuffers()
             jngl.translate(-jngl.getScreenWidth()/2, -jngl.getScreenHeight()/2)
             jngl.updateInput()
Example #2
0
def printCentered(t, x, y):
    jngl.print(t, int(x-jngl.getTextWidth(t) / 2), y)
Example #3
0
            level += 1
            if level >= len(levels): level = 0
        elif jngl.keyPressed(jngl.key.Left):
            level -= 1
            if level < 0: level = len(levels)-1
        elif jngl.keyPressed(jngl.key.Escape):
            #import sys
            #jngl.hideWindow()
            running = False
            break
            #sys.exit()
        bouncingEnterButton((game.windowWidth/2) + 320, (game.windowHeight/2)+100)
        bouncingButton((game.windowWidth/2)-225, (game.windowHeight/2) + 115, "img/World/key_left_64.png")
        bouncingButton((game.windowWidth/2)+180, (game.windowHeight/2) + 115, "img/World/key_right_64.png")
        jngl.setFontSize(20)
        jngl.print(levels[level], int((game.windowWidth/2) - jngl.getTextWidth(levels[level]) / 2), (game.windowHeight/2)+138)
        jngl.print("Press F1 for Help", 10, game.windowHeight-30)
        if jngl.keyDown(jngl.key.F1):
            jngl.draw(HELPSCREEN, (game.windowWidth/2)-jngl.getWidth(HELPSCREEN)/2, (game.windowHeight/2)-jngl.getHeight(HELPSCREEN)/2)
        jngl.print("www.somyeol.com", game.windowWidth-180, game.windowHeight-30)
        jngl.swapBuffers()
        jngl.translate(-jngl.getScreenWidth()/2, -jngl.getScreenHeight()/2)
        jngl.updateInput()
        selected = 0


    #Level select dialog
    files = os.listdir("data/maps/" + levels[level])
    screen = 0
    screenAnimation = 0
    screenAnimationGoal = screenAnimation