def renderLight(self, renderer, xMin, yMin): mod = 1 texture = driver.lightTextures[7] # default red if self.attacking is 1: texture = driver.lightTextures[6] # change to green sdl.setTextureAlphaMod(texture, 64) mod = 10 elif self.attacking is 2: texture = driver.lightTextures[3] # change to orange sdl.setTextureAlphaMod(texture, 64) elif self.attacking is 3: texture = driver.lightTextures[4] # change to purple sdl.setTextureAlphaMod(texture, 64) if self.hurt: texture = driver.lightTextures[5] # change to blue sdl.setTextureAlphaMod(texture, 64) if self.dying: color = (self.currentFrame % 5) + 3 texture = driver.lightTextures[ color] # change to self.currentFrame % len(driver.lightTextures) sdl.setTextureAlphaMod(texture, 255) if color is 6: mod = 10 textureW, textureH = chef.textureSize(texture) textureW *= mod textureH *= mod lightRect = sdl.Rect((0, 0, textureW, textureH)) sdl.setTextureBlendMode(texture, sdl.BLENDMODE_ADD) posRect = sdl.Rect( (int(self.xPos) - int(xMin) + int(self.width / 2) - int(textureW / 2), int(self.yPos) - int(yMin) + int(self.height / 2) - int(textureH / 2), textureW, textureH)) sdl.renderCopy(renderer, texture, lightRect, posRect)
def load(self): images = [] if self.num is 1: images.append(sdl.image.load("graphics/story/intro_0.png")) images.append(sdl.image.load("graphics/story/intro_1.png")) images.append(sdl.image.load("graphics/story/intro_2.png")) images.append(sdl.image.load("graphics/story/intro_3.png")) images.append(sdl.image.load("graphics/states/level1.png")) elif self.num is 2: images.append(sdl.image.load("graphics/story/basement_0.png")) images.append(sdl.image.load("graphics/story/basement_1.png")) elif self.num is 3: images.append(sdl.image.load("graphics/states/level2.png")) elif self.num is 4: images.append(sdl.image.load("graphics/story/miniboss_0.png")) images.append(sdl.image.load("graphics/story/miniboss_1.png")) elif self.num is 5: images.append(sdl.image.load("graphics/states/level3.png")) elif self.num is 6: for x in range(0, 8): images.append(sdl.image.load('graphics/story/boss_' + str(x) + '.png')) elif self.num is 7: images.append(sdl.image.load("graphics/story/you_won.png")) images.append(sdl.image.load("graphics/states/credits.png")) global blackScreen blackScreen = driver.renderer.createTextureFromSurface(sdl.image.load('graphics/colors/black.png')) sdl.setTextureBlendMode(blackScreen,sdl.BLENDMODE_BLEND) self.length = len(images) for x in range(len(images)): self.textures.append(driver.renderer.createTextureFromSurface(images[x])) sdl.freeSurface(images[x]) global textureRect textureW, textureH = game.textureSize(self.textures[0]) textureRect = game.centeredRect(game.width, game.height, textureW, textureH)
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)
def run(self): running = True currentTime = 0 lastTime = 0 time = 0 event = sdl.Event() while running: sdl.renderClear(driver.renderer) textureW, textureH = game.textureSize(backgroundTexture) backgroundRect = game.centeredRect(game.width, game.height, textureW, textureH) sdl.renderCopy(driver.renderer, backgroundTexture, None, backgroundRect) while sdl.pollEvent(event): if event.type == sdl.MOUSEBUTTONDOWN: running = False self.next = "menu" elif event.type == sdl.KEYDOWN: if event.key.keysym.sym in [sdl.K_q, sdl.K_ESCAPE]: running = False game.turnOff() elif event.key.keysym.sym in [sdl.K_SPACE, sdl.K_RETURN]: running = False self.next = "menu" sdl.renderPresent(driver.renderer)
def run(self): sdl.renderClear(driver.renderer) textureW, textureH = game.textureSize(loadingTexture) textureRect = game.centeredRect(game.width, game.height, textureW, textureH) sdl.renderCopy(driver.renderer, loadingTexture, None, textureRect) sdl.renderPresent(driver.renderer)
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)
def renderLight(self, renderer, xMin, yMin): if 'carrot' in driver.chef.items: textureW, textureH = chef.textureSize(driver.lightTextures[0]) lightRect = sdl.Rect((0, 0, textureW, textureH)) sdl.setTextureBlendMode(driver.lightTextures[0], sdl.BLENDMODE_ADD) sdl.setTextureAlphaMod(driver.lightTextures[0], 128) posRect = sdl.Rect( (int(self.xPos) - int(xMin) + int(self.width / 2) - int(textureW / 2), int(self.yPos) - int(yMin) + int(self.height / 2) - int(textureH / 2), textureW, textureH)) sdl.renderCopy(renderer, driver.lightTextures[0], lightRect, posRect)
def run(self): running = True currentTime = 0 lastTime = 0 time = 0 event = sdl.Event() textureW, textureH = game.textureSize(full) textureRect = game.centeredRect(game.width, game.height, textureW, textureH) sdl.setTextureBlendMode(full, sdl.BLENDMODE_ADD) while running: currentTime = sdl.getTicks() dt = currentTime - lastTime time += dt lastTime = currentTime if time <= 3000: sdl.renderClear(driver.renderer) alpha = int(round((time / 3000.0) * 255)) if alpha > 255: time += 3000 alpha = 255 sdl.renderCopy(driver.renderer, fade, None, textureRect) sdl.setTextureAlphaMod(full, alpha) sdl.renderCopy(driver.renderer, full, None, textureRect) while sdl.pollEvent(event): if event.type == sdl.KEYDOWN: time += 3000 elif event.type == sdl.MOUSEBUTTONDOWN: time += 3000 if event.key.keysym.sym in [sdl.K_q, sdl.K_ESCAPE]: running = False game.turnOff() else: sdl.renderCopy(driver.renderer, fade, None, textureRect) sdl.renderCopy(driver.renderer, full, None, textureRect) while sdl.pollEvent(event): if event.type == sdl.MOUSEBUTTONDOWN: running = False self.next = "menu" if event.type == sdl.KEYDOWN: if event.key.keysym.sym in [sdl.K_q, sdl.K_ESCAPE]: running = False game.turnOff() else: running = False self.next = "menu" sdl.renderPresent(driver.renderer)
def renderLight(self, renderer, xMin, yMin): return textureW, textureH = chef.textureSize(driver.lightTextures[1]) lightRect = sdl.Rect((0, 0, textureW, textureH)) sdl.setTextureBlendMode(driver.lightTextures[1], sdl.BLENDMODE_ADD) if 'carrot' not in driver.chef.items: posRect = sdl.Rect( (int(self.xPos) - int(xMin) + int(self.width / 2) - int(textureW / 2), int(self.yPos) - int(yMin) + int(self.height / 2) - int(textureH / 2), textureW, textureH)) else: posRect = sdl.Rect( (int(self.xPos) - int(xMin) + int(self.width / 2) - int(textureW), int(self.yPos) - int(yMin) + int(self.height / 2) - int(textureH), textureW * 2, textureH * 2)) sdl.renderCopy(renderer, driver.lightTextures[1], lightRect, posRect)
def run(self): running = True currentTime = 0 lastTime = 0 time = 0 pressed = False event = sdl.Event() while running: currentTime = sdl.getTicks() dt = currentTime - lastTime time += dt lastTime = currentTime textureW, textureH = game.textureSize(winTexture) goRect = game.centeredRect(game.width, game.height, textureW, textureH) if time <= 3000: sdl.renderClear(driver.renderer) alpha = int(round((time / 3000.0) * 255)) sdl.setTextureAlphaMod(winTexture, alpha) sdl.renderCopy(driver.renderer, winTexture, None, goRect) while sdl.pollEvent(event): if event.type == sdl.KEYDOWN: time += 3000 if event.key.keysym.sym in [sdl.K_q, sdl.K_ESCAPE]: running = False game.turnOff() else: sdl.renderClear(driver.renderer) sdl.renderCopy(driver.renderer, winTexture, None, goRect) while sdl.pollEvent(event): if event.type == sdl.KEYDOWN: if event.key.keysym.sym in [sdl.K_q, sdl.K_ESCAPE]: running = False game.turnOff() elif event.key.keysym.sym in [ sdl.K_SPACE, sdl.K_RETURN ]: running = False self.next = "highScore" sdl.renderPresent(driver.renderer)
def renderLight(self, renderer, xMin, yMin): # textureW, textureH = chef.textureSize(driver.lightTextures[1]) # lightRect = sdl.Rect((0, 0, textureW, textureH)) # sdl.setTextureBlendMode(driver.lightTextures[1], sdl.BLENDMODE_ADD) # sdl.setTextureAlphaMod(driver.lightTextures[1], 128) # posRect = sdl.Rect((int(self.xPos) - int(xMin) + int(self.width/2) - int(textureW/2) ,int(self.yPos) - int(yMin) + int(self.height/2) - int(textureH/2), textureW, textureH)) # sdl.renderCopy(renderer, driver.lightTextures[1], lightRect, posRect) mod = 1 texture = driver.lightTextures[5] # default blue if self.hurt: texture = driver.lightTextures[7] # change to red sdl.setTextureAlphaMod(texture, 255) elif self.summoning: texture = driver.lightTextures[6] # change to green sdl.setTextureAlphaMod(texture, 64) mod = 10 elif self.transforming: texture = driver.lightTextures[3] # change to orange sdl.setTextureAlphaMod(texture, 64) elif self.transformed: texture = driver.lightTextures[7] # change to red sdl.setTextureAlphaMod(texture, 64) if self.dying: color = (self.currentFrame % 5) + 3 texture = driver.lightTextures[color] sdl.setTextureAlphaMod(texture, 255) if color is 6: mod = 10 textureW, textureH = chef.textureSize(texture) textureW *= mod textureH *= mod lightRect = sdl.Rect((0, 0, textureW, textureH)) sdl.setTextureBlendMode(texture, sdl.BLENDMODE_ADD) posRect = sdl.Rect( (int(self.xPos) - int(xMin) + int(self.width / 2) - int(textureW / 2), int(self.yPos) - int(yMin) + int(self.height / 2) - int(textureH / 2), textureW, textureH)) sdl.renderCopy(renderer, texture, lightRect, posRect)
def renderLight(self, renderer, xMin, yMin): texture = driver.lightTextures[7] modX = 1 modY = 1 if self.title is 'green': texture = driver.lightTextures[6] # change to green elif self.title is 'purple': texture = driver.lightTextures[4] # change to purple modX = 1 modY = 1 elif self.title is 'knife': texture = driver.lightTextures[1] # change to green return textureW, textureH = chef.textureSize(texture) textureW = textureW / modX textureH = textureH / modY lightRect = sdl.Rect((0, 0, int(textureW), int(textureH))) sdl.setTextureBlendMode(texture, sdl.BLENDMODE_ADD) sdl.setTextureAlphaMod(texture, 128) posRect = sdl.Rect((int(self.xPos) - int(xMin) + int(self.width / 2) - int(textureW / 2), int(self.yPos) - int(yMin) + int(self.height / 2) - int(textureH / 2), int(textureW), int(textureH))) sdl.renderCopy(renderer, texture, None, posRect)
def run(self): cursor1 = MC.Chef(220, 190, 50, 80, 'none', 0, 0, 0, 0.001, 0.001, cursorTexture, True, 0, 0, 100, True, 1) cursor2 = MC.Chef(535, 190, 50, 80, 'none', 0, 0, 0, 0.001, 0.001, cursorTexture, True, 0, 0, 100, True, 1) running = True currentTime = 0 lastTime = 0 time = 0 cursorPos = 0 brightnessPos = 10 volumePos = round((driver.volume - 8) / 12) event = sdl.Event() textureW, textureH = game.textureSize(optionsTexture) textureRect = game.centeredRect(game.width, game.height, textureW, textureH) sdl.renderClear(driver.renderer) sdl.renderCopy(driver.renderer, optionsTexture, None, textureRect) # render cursor in time1 = ((int(time / 125)) % 4) time2 = ((int(time / 500)) % 4) # the rectangle that defines which sprite part the sprites spriteFrame = sdl.Rect((time1 * 48, 0, 48, 80)) spriteFrame2 = sdl.Rect((time2 * 48, 0, 48, 80)) sdl.renderCopy(driver.renderer, cursorTexture, spriteFrame2, cursor1.getRect(0, 0)) sdl.renderCopy(driver.renderer, cursorTexture, spriteFrame2, cursor2.getRect(0, 0)) #render in brightness indicators for i in range(brightnessPos): spot = sdl.Rect((280 + 25 * i, 357, 18, 18)) sdl.renderCopy(driver.renderer, indTexture, None, spot) #render in volume indicators for i in range(volumePos): spot = sdl.Rect((280 + 25 * i, 242, 18, 18)) sdl.renderCopy(driver.renderer, indTexture, None, spot) sdl.renderPresent(driver.renderer) while running: hover = None clicked = None #### TIME MANAGEMENT #### currentTime = sdl.getTicks() dt = currentTime - lastTime time += dt lastTime = currentTime #### TEXTURE MEASUREMENTS #### textureW, textureH = game.textureSize(optionsTexture) textureRect = game.centeredRect(game.width, game.height, textureW, textureH) #### HANDLE INPUT #### while sdl.pollEvent(event): if event.type == sdl.QUIT: running = False game.turnOff() elif event.type == sdl.KEYUP: if event.key.keysym.sym in [sdl.K_q, sdl.K_ESCAPE]: running = False game.turnOff() elif event.type == sdl.MOUSEBUTTONDOWN: if event.button.button == sdl.BUTTON_LEFT: for i in range(len(boxes)): if clicked is None: sdl.mixer.playChannel(0, selectSound, 0) clicked = boxes[i].checkEvent( event.motion.x, event.motion.y) for i in range(len(volumeBoxes)): here = volumeBoxes[i].checkEvent( event.motion.x, event.motion.y) if here is not None: volumePos = here elif event.type == sdl.MOUSEMOTION: for i in range(len(boxes)): if (boxes[i].checkMotion(event.motion.x, event.motion.y)): hover = boxes[i].cursorPos if event.type == sdl.KEYDOWN: if event.key.keysym.sym == sdl.K_UP: sdl.mixer.playChannel(1, scrollSound, 0) cursorPos -= 1 if cursorPos <= -1: cursorPos = 2 elif event.key.keysym.sym == sdl.K_DOWN: sdl.mixer.playChannel(1, scrollSound, 0) cursorPos = (cursorPos + 1) % 3 elif event.key.keysym.sym == sdl.K_RIGHT: sdl.mixer.playChannel(1, scrollSound, 0) if cursorPos is 1: if sdl.getWindowBrightness(driver.window) < 1: brightnessPos += 1 sdl.setWindowBrightness( driver.window, sdl.getWindowBrightness(driver.window) + 0.05) elif cursorPos is 0: if volumePos < 10: volumePos += 1 sdl.mixer.volume(-1, volumePos * 12) driver.volume = volumePos * 12 elif event.key.keysym.sym == sdl.K_LEFT: sdl.mixer.playChannel(1, scrollSound, 0) if cursorPos is 1: if sdl.getWindowBrightness(driver.window) > .5: brightnessPos -= 1 sdl.setWindowBrightness( driver.window, sdl.getWindowBrightness(driver.window) - 0.05) elif cursorPos is 0: if volumePos > 1: volumePos -= 1 sdl.mixer.volume(-1, volumePos * 12) driver.volume = volumePos * 12 elif event.key.keysym.sym == sdl.K_RETURN: if (cursorPos == 0): # Call to play game sdl.mixer.playChannel(1, scrollSound, 0) elif (cursorPos == 1): #ADD IN OPTIONS sdl.mixer.playChannel(1, scrollSound, 0) elif (cursorPos == 2): #Call to controls screen sdl.mixer.playChannel(0, selectSound, 0) running = False self.next = "menu" while (sdl.getTicks() - currentTime < 300): pass if (hover is not None): cursorPos = hover if clicked is not None: if cursorPos is 2: sdl.mixer.playChannel(0, selectSound, 0) running = False self.next = "menu" cursor1.updateY(190 + 115 * cursorPos) cursor2.updateY(190 + 115 * cursorPos) #### RENDER #### sdl.renderClear(driver.renderer) sdl.renderCopy(driver.renderer, optionsTexture, None, textureRect) # render cursor in time1 = ((int(time / 125)) % 4) time2 = ((int(time / 500)) % 4) # the rectangle that defines which sprite part the sprites spriteFrame = sdl.Rect((time1 * 48, 0, 48, 80)) spriteFrame2 = sdl.Rect((time2 * 48, 0, 48, 80)) sdl.renderCopy(driver.renderer, cursorTexture, spriteFrame2, cursor1.getRect(0, 0)) sdl.renderCopy(driver.renderer, cursorTexture, spriteFrame2, cursor2.getRect(0, 0)) for i in range(brightnessPos): spot = sdl.Rect((280 + 25 * i, 357, 18, 18)) sdl.renderCopy(driver.renderer, indTexture, None, spot) for i in range(volumePos): spot = sdl.Rect((280 + 25 * i, 242, 18, 18)) sdl.renderCopy(driver.renderer, indTexture, None, spot) sdl.renderPresent(driver.renderer)
def renderNoWepMessage(self, renderer, xMin, yMin): textureW, textureH = chef.textureSize(self.textures[2][14]) message = sdl.Rect((240, 500, textureW, textureH)) sdl.renderCopy(renderer, self.textures[2][14], None, message)
def run(self, itemName): sdl.mixer.volume(-1, driver.volume) sdl.mixer.volumeMusic(driver.volume) running = True currentTime = 0 lastTime = 0 time = 0 keepOnPlaying = True event = sdl.Event() sdl.mixer.allocateChannels(2) selectSound = sdl.mixer.loadWAV_RW( sdl.RWFromFile("music//chunks/menu_select.wav", 'rw'), 0) cur = 0 if itemName is "bsv": cur = 0 elif itemName is "key": cur = 1 elif itemName is "ladles": cur = 2 elif itemName is "graters": cur = 3 elif itemName is "carrot": cur = 4 elif itemName is "pizza": cur = 5 elif itemName is "tomato": cur = 6 elif itemName is "knives": cur = 7 while running: #### TIME MANAGEMENT #### currentTime = sdl.getTicks() dt = currentTime - lastTime time += dt lastTime = currentTime #### TEXTURE MEASUREMENTS #### textureW, textureH = game.textureSize(driver.chef.textures[3][cur]) textureRect = game.centeredRect(game.width, game.height, textureW, textureH) sdl.renderClear(driver.renderer) self.camera.display(time, dt, False, None) sdl.renderCopy(driver.renderer, driver.chef.textures[3][cur], None, textureRect) sdl.renderPresent(driver.renderer) #### HANDLE INPUT #### while sdl.pollEvent(event): if event.type == sdl.QUIT: running = False game.turnOff() keepOnPlaying = False elif event.type == sdl.KEYUP: if event.key.keysym.sym in [sdl.K_q, sdl.K_ESCAPE]: running = False game.turnOff() keepOnPlaying = False if event.type == sdl.KEYDOWN: if event.key.keysym.sym is sdl.K_SPACE: sdl.mixer.playChannel(0, selectSound, 0) running = False keepOnPlaying = True #### RENDER #### if not running: return keepOnPlaying sdl.renderClear(driver.renderer) if selectSound is not None: sdl.mixer.freeChunk(selectSound)
def getMessageRect(self, num): textureW, textureH = game.textureSize(self.texture[num]) return sdl.Rect((240, 500, textureW, textureH))
def run(self): sdl.mixer.volume(-1, driver.volume) sdl.mixer.volumeMusic(driver.volume) cursor1 = MC.Chef(240, 160, 50, 80, 'none', 0, 0, 0, 0.001, 0.001, cursorTexture, True, 0, 0, 100, True, 1) cursor2 = MC.Chef(515, 160, 50, 80, 'none', 0, 0, 0, 0.001, 0.001, cursorTexture, True, 0, 0, 100, True, 1) running = True currentTime = 0 lastTime = 0 time = 0 cursorPos = 0 keepOnPlaying = True event = sdl.Event() controls = Controls() options = Options() while running: hover = None clicked = None #### TIME MANAGEMENT #### currentTime = sdl.getTicks() dt = currentTime - lastTime time += dt lastTime = currentTime #### TEXTURE MEASUREMENTS #### textureW, textureH = game.textureSize(pauseTexture) textureRect = game.centeredRect(game.width, game.height, textureW, textureH) #### HANDLE INPUT #### while sdl.pollEvent(event): if event.type == sdl.QUIT: running = False game.turnOff() keepOnPlaying = False elif event.type == sdl.KEYUP: if event.key.keysym.sym in [sdl.K_q, sdl.K_ESCAPE]: running = False game.turnOff() keepOnPlaying = False elif event.type == sdl.MOUSEBUTTONDOWN: if event.button.button == sdl.BUTTON_LEFT: for i in range(len(boxes)): if clicked is None: sdl.mixer.playChannel(0, selectSound, 0) clicked = boxes[i].checkEvent( event.motion.x, event.motion.y) elif event.type == sdl.MOUSEMOTION: for i in range(len(boxes)): if (boxes[i].checkMotion(event.motion.x, event.motion.y)): hover = boxes[i].cursorPos elif event.type == sdl.KEYDOWN: if event.key.keysym.sym == sdl.K_UP: sdl.mixer.playChannel(1, scrollSound, 0) cursorPos -= 1 if cursorPos <= -1: cursorPos = 3 elif event.key.keysym.sym == sdl.K_DOWN: sdl.mixer.playChannel(1, scrollSound, 0) cursorPos = (cursorPos + 1) % 4 elif event.key.keysym.sym == sdl.K_p: sdl.mixer.playChannel(0, selectSound, 0) running = False keepOnPlaying = True elif event.key.keysym.sym == sdl.K_RETURN: if (cursorPos == 0): # Call to play game sdl.mixer.playChannel(0, selectSound, 0) running = False keepOnPlaying = True elif (cursorPos == 1): #ADD IN OPTIONS sdl.mixer.playChannel(0, selectSound, 0) options.load() options.run() options.cleanup() elif (cursorPos == 2): #Call to controls screen sdl.mixer.playChannel(0, selectSound, 0) controls.load() controls.run() controls.cleanup() elif (cursorPos == 3): # Call to quit sdl.mixer.playChannel(0, selectSound, 0) running = False game.turnOff() keepOnPlaying = False while (sdl.getTicks() - currentTime < 300): pass #### RENDER #### if (clicked is not None): if clicked is 'quit': running = False game.turnOff() keepOnPlaying = False elif clicked is "controls": controls.load() controls.run() controls.cleanup() elif clicked is "options": options.load() options.run() options.cleanup() elif clicked is "resume": running = False keepOnPlaying = True if (hover is not None): cursorPos = hover cursor1.updateY(220 + 60 * cursorPos) cursor2.updateY(220 + 60 * cursorPos) sdl.renderClear(driver.renderer) self.camera.display(time, dt, False, None) sdl.renderCopy(driver.renderer, pauseTexture, None, textureRect) # render cursor in time1 = ((int(time / 125)) % 4) time2 = ((int(time / 500)) % 4) # the rectangle that defines which sprite part the sprites spriteFrame = sdl.Rect((time1 * 48, 0, 48, 80)) spriteFrame2 = sdl.Rect((time2 * 48, 0, 48, 80)) sdl.renderCopy(driver.renderer, cursorTexture, spriteFrame2, cursor1.getRect(0, 0)) sdl.renderCopy(driver.renderer, cursorTexture, spriteFrame2, cursor2.getRect(0, 0)) sdl.renderPresent(driver.renderer) if not running: return keepOnPlaying