Пример #1
0
    def renderDamage(self, renderer, xMin, yMin):

        #if there has been any change in health
        if (self.changeInHp != 0):
            #create the string
            stringDamage = str(self.changeInHp)
            #make it red
            color = sdl.Color((255, 0, 0)).cdata[0]
            #but if the "damage" is positive (ie, healing)
            if (self.changeInHp > 0):
                #show that it is positive
                stringDamage = "+" + str(self.changeInHp)
                #and make it green
                color = sdl.Color((0, 255, 0)).cdata[0]

            dmgSurf = sdl.ttf.renderText_Solid(driver.scoreFont, stringDamage,
                                               color)
            dmgTexture = renderer.createTextureFromSurface(dmgSurf)
            textureW, textureH = chef.textureSize(dmgTexture)
            dmgRect = sdl.Rect()
            dmgRect.x = int(self.xPos + textureW // 6 - xMin)
            dmgRect.y = int(self.yPos - textureH - yMin)
            dmgRect.w = textureW
            dmgRect.h = textureH
            dmgRect.x = int(dmgRect.x)
            dmgRect.y = int(dmgRect.y)
            sdl.renderCopy(renderer, dmgTexture, None, dmgRect)
            sdl.freeSurface(dmgSurf)
            sdl.destroyTexture(dmgTexture)
Пример #2
0
 def cleanup(self):
     sdl.renderClear(driver.renderer)
     if pauseTexture is not None:
         sdl.destroyTexture(pauseTexture)
     if cursorTexture is not None:
         sdl.destroyTexture(cursorTexture)
     if scrollSound is not None:
         sdl.mixer.freeChunk(scrollSound)
     if selectSound is not None:
         sdl.mixer.freeChunk(selectSound)
Пример #3
0
 def renderScore(self, renderer):
     stringScore = "Score: " + str(self.totalScore)
     score = sdl.ttf.renderText_Solid(driver.scoreFont, stringScore,
                                      sdl.Color((255, 255, 255)).cdata[0])
     scoreTexture = renderer.createTextureFromSurface(score)
     textureW, textureH = game.textureSize(scoreTexture)
     scoreRect = game.centeredRect(game.width, 60, textureW, textureH)
     sdl.renderCopy(renderer, scoreTexture, None, scoreRect)
     sdl.freeSurface(score)
     sdl.destroyTexture(scoreTexture)
Пример #4
0
 def cleanup(self):
     if textureBG is not None:
       sdl.destroyTexture(textureBG)
     if cursorTexture is not None:
       sdl.destroyTexture(cursorTexture)
     if scrollSound is not None:
       sdl.mixer.freeChunk(scrollSound)
     if selectSound is not None:
       sdl.mixer.freeChunk(selectSound)
     if music is not None:
       sdl.mixer.freeMusic(music)
Пример #5
0
    def cleanup(self):
        story1.cleanup()
        story2.cleanup()
        if music is not None:
            sdl.mixer.freeMusic(music)
        for x in range(len(hit)):
            if hit[x] is not None:
                sdl.mixer.freeChunk(hit[x])
        if getOut is not None:
            sdl.mixer.freeChunk(getOut)

        if ratDyingSound is not None:
            sdl.mixer.freeChunk(ratDyingSound)

        if ladleHit is not None:
            sdl.mixer.freeChunk(ladleHit)

        if hitGeneric is not None:
            sdl.mixer.freeChunk(hitGeneric)

        if woosh is not None:
            sdl.mixer.freeChunk(woosh)

        for x in range(len(ratTextures)):
            if ratTextures[x] is not None:
                sdl.destroyTexture(ratTextures[x])

        for x in range(len(mapTextures)):
            if mapTextures[x] is not None:
                sdl.destroyTexture(mapTextures[x])

        for x in range(len(objectTextures)):
            if objectTextures[x] is not None:
                sdl.destroyTexture(objectTextures[x])
Пример #6
0
    def cleanup(self):
        if music is not None:
            sdl.mixer.freeMusic(music)

        for x in range(len(ratTextures)):
            if ratTextures[x] is not None:
                sdl.destroyTexture(ratTextures[x])

        for x in range(len(mapTextures)):
            if mapTextures[x] is not None:
                sdl.destroyTexture(mapTextures[x])

        for x in range(len(objectTextures)):
            if objectTextures[x] is not None:
                sdl.destroyTexture(objectTextures[x])

        for x in range(len(hit)):
            if hit[x] is not None:
                sdl.mixer.freeChunk(hit[x])

        if ratDyingSound is not None:
            sdl.mixer.freeChunk(ratDyingSound)

        if explosionSound is not None:
            sdl.mixer.freeChunk(explosionSound)

        if haveCarrot is not None:
            sdl.mixer.freeChunk(haveCarrot)

        if needCarrot is not None:
            sdl.mixer.freeChunk(needCarrot)

        if ladleHit is not None:
            sdl.mixer.freeChunk(ladleHit)

        if graterHit is not None:
            sdl.mixer.freeChunk(graterHit)

        if hitGeneric is not None:
            sdl.mixer.freeChunk(hitGeneric)

        if woosh is not None:
            sdl.mixer.freeChunk(woosh)
Пример #7
0
	def cleanup(self):
		for x in range(len(self.textures)):
			sdl.destroyTexture(self.textures[x])
 def cleanup(self):
     if fade is not None:
         sdl.destroyTexture(fade)
     if full is not None:
         sdl.destroyTexture(full)
Пример #9
0
 def update(self, dt):
     for particle in self.particles:
         particle.update(dt)
         if not particle.isAlive():
             self.particles.remove(particle)
             if self.type is "rat":
                 sdl.destroyTexture(self.tex)
                 sdl.destroyTexture(self.expLight)
             elif self.type is "explosion":
                 sdl.destroyTexture(self.tex3)
                 sdl.destroyTexture(self.tex2)
                 sdl.destroyTexture(self.tex1)
                 sdl.destroyTexture(self.expLight)
Пример #10
0
 def cleanup(self):
     sdl.destroyTexture(loadingTexture)
 def cleanup(self):
     if backgroundTexture is not None:
         sdl.destroyTexture(backgroundTexture)
Пример #12
0
 def cleanup(self):
     if gameOverTexture is not None:
         sdl.destroyTexture(gameOverTexture)
Пример #13
0
 def cleanup(self):
     if winTexture is not None:
         sdl.destroyTexture(winTexture)