0 4mq@DmU4eLa,@yYiYL$,H4 {ͫg2Tv2Tv2TvͫgE#2Tv2Tv$ x iPevxwffUefffffeiYVeeeFdfddFDFDDHDDFDDDDDffffeeYdeFfDFDDDDDDFDDDDdDDDDDffffYeYVUeeFUfddDFFDfFDDDDFdDDDDDDDDFDDDDDDDDDDDDDDDDDDdDDDDDDDDDDDDDDDdDDDDDDDDDDHDDDDDDDDDDDDDDdDfDDdYFDeDDFdDDdFDDDDHDDDDDDDDDFDdiDDdeDDdFDFDDdeDDDFDDDDfffffffffffffffffffffffffffffffffffVeVVUeddTeDDFfDFddDDDdHDDdhfffYUVUVEFeddfdDFFFDDFDDFDFDDDDdDDDdDddDDDdDDDdDFDdDDDdDDDdFDDDFDDHFDDDFDDDFdDDFDDDFDDFDDDDDDDUUYYUUUUUUUUUDDDDUYUUUUYYUUUUUUUUUUDUUUUUEDUDDUDDTUUUUUUEDDUUUUUUUUUUUUDDUUUUUUUUEDDTUUUUUUUUUUUETUDTUUUUUUUDDUDUUDUDUTUUDUUUUUUDUUEUUUUEDUUETUDUUDEUDTUDTUUUUUUUUUUUUUETUUUUUUUETEUUUUUUUUUUUUUUUUUUUUEDDUEDUUUUUUUDDUDDDDDDDDUUUUUUUUUUTUUUDUUUUUDTUUDDDDDDDDUUUUUUUUEUUUUUTUUUUUEDUDDDDDDDDDUUUUUUUUUUUUUUUUUDDUTDDDDDDDDDDDUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUDDDDDFDDDDDDDDDDDDDDDDDDDDffffDDDDDDDHdfDDdFDd targetTime - timeInBeatMap + 10 and modulatedTime < targetTime) or modulatedTime > doubleWholeNote+negativeOffset) then --case in which the beat is being displayed onscreen. timeUntilHit = targetTime - modulatedTime if(modulatedTime > doubleWholeNote + negativeOffset) then timeUntilHit = doubleWholeNote - modulatedTime + targetTime end distanceToHit = timeUntilHit/timeInBeatMap*beatMapLength*6.8 beatX = beatMapX + 10 + distanceToHit --render it onto the beatmap. if(beatX > beatMapX + beatMapLength*8 - beatSpawnInTime) then spr(428,beatX,beatMapY+4,0,1,0,0,2,2) else spr(332,beatX,beatMapY+4,0,1,0,0,2,2) spr(323,beatX+4,beatMapY,0,1,0,0,1,3) end end end --draw "target" spr(324,beatMapX+10,beatMapY,0,1,0,0,2,3) --draw a jump prompt every sixteenth note that is not also an eighth note. for index = 1, #jumpBeats, 1 do targetTime = jumpBeats[index]*sixteenthNote negativeOffset = targetTime - timeInBeatMap if((modulatedTime > targetTime - timeInBeatMap and modulatedTime < targetTime + forgivenessWindow) or modulatedTime > doubleWholeNote+negativeOffset) then --case in which the beat is being displayed onscreen. timeUntilHit = targetTime - modulatedTime if(modulatedTime > doubleWholeNote + negativeOffset) then timeUntilHit = doubleWholeNote - modulatedTime + targetTime end distanceToHit = timeUntilHit/timeInBeatMap*beatMapLength*6.8 beatX = beatMapX + 10 + distanceToHit --render it onto the beatmap. if(beatX > beatMapX + beatMapLength*8 - beatSpawnInTime) then spr(310,beatX+4,beatMapY+8,0,1,0,0,1,1) else spr(308,beatX+4,beatMapY+8,0,1,0,0,1,1) end end end for index = 1, #beats, 1 do targetTime = beats[index].timing*sixteenthNote negativeOffset = targetTime - timeInBeatMap if beats[index].breakTime ~= -100 then --case in which the beat has been broken. --kinda sloppy code? don't worry about it. if(beats[index].size == 1) then if(currentTime > beats[index].breakTime + beatBreakTime*3) then if(currentTime > beats[index].breakTime + wholeNote) then --re-enable the beat beats[index].breakTime = -100 end elseif(currentTime > beats[index].breakTime + beatBreakTime*2) then spr(330,beatMapX+10,beatMapY+4,0,1,0,0,2,2) elseif(currentTime > beats[index].breakTime + beatBreakTime) then spr(328,beatMapX+10,beatMapY+4,0,1,0,0,2,2) else spr(326,beatMapX+10,beatMapY+4,0,1,0,0,2,2) end else if(currentTime > beats[index].breakTime + beatBreakTime*3) then if(currentTime > beats[index].breakTime + wholeNote) then --re-enable the beat beats[index].breakTime = -100 end elseif(currentTime > beats[index].breakTime + beatBreakTime*2) then spr(330,beatMapX+10,beatMapY+4,0,1,0,0,2,2) elseif(currentTime > beats[index].breakTime + beatBreakTime) then spr(360,beatMapX+10,beatMapY+4,0,1,0,0,2,2) else spr(358,beatMapX+10,beatMapY+4,0,1,0,0,2,2) end end elseif((modulatedTime > targetTime - timeInBeatMap and modulatedTime < targetTime + forgivenessWindow) or modulatedTime > doubleWholeNote+negativeOffset) then --case in which the beat is being displayed onscreen. timeUntilHit = targetTime - modulatedTime if(modulatedTime > doubleWholeNote + negativeOffset) then timeUntilHit = doubleWholeNote - modulatedTime + targetTime end distanceToHit = timeUntilHit/timeInBeatMap*beatMapLength*6.8 beatX = beatMapX + 10 + distanceToHit --set this beat as the current beat if the previously-current beat before it goes inactive. prevBeat = index-1 if prevBeat == 0 then prevBeat = #beats end if(currentBeatIndex == prevBeat and beats[prevBeat].active == false) then currentBeatIndex = index end --render it onto the beatmap (and set it to active if it's still spawning in). if(beats[index].size == 1) then if(beatX > beatMapX + beatMapLength*8 - beatSpawnInTime) then spr(370,beatX,beatMapY+4,0,1,0,0,2,2) beats[index].active = true else spr(290,beatX,beatMapY+4,0,1,0,0,2,2) end elseif(beats[index].size == 2) then if(beatX > beatMapX + beatMapLength*8 - beatSpawnInTime) then spr(368,beatX,beatMapY+4,0,1,0,0,2,2) beats[index].active = true else spr(300,beatX,beatMapY+4,0,1,0,0,2,2) end end else beats[index].active = false end end end function initPlatforms(configID) platforms = platformConfigurations[configID] beats = {} pos = 1 for index = 1, #platforms, 1 do beat = {timing = 0, size = 0, active = true, breakTime = -100} beat.size = platforms[index].position - pos pos = platforms[index].position beat.timing = platforms[index].timing table.insert(beats,beat) end end function updatePlatforms() for i = 1, #platforms-1, 1 do currentPlatform = platforms[i] platformTiming = (currentPlatform.timing-1)*sixteenthNote platformDuration = (currentPlatform.duration)*sixteenthNote nonTransitionWindow = platformWindow - platformTransitionTime --The offsets account for the possibility that the platform has to start moving before the start of the next four-count, or return to its position after the end of the last four-count. negativeOffset = platformTiming - platformWindow positiveOffset = platformTiming + platformWindow - doubleWholeNote if ((modulatedTime < (platformTiming + nonTransitionWindow + platformDuration) and modulatedTime > (platformTiming - nonTransitionWindow)) or modulatedTime < positiveOffset-platformTransitionTime or modulatedTime > doubleWholeNote + negativeOffset + platformTransitionTime) then --This is the case in which the platform is in its fallen state (immediately before and after the beat). spr(264,screenPositions[currentPlatform.position],85,0,1,0,0,2,3) elseif ((modulatedTime < platformTiming + platformWindow + platformDuration and modulatedTime > platformTiming) or modulatedTime < positiveOffset) then --This is the case in which the platform is in a transition frame (going up). This also kills the player if they're standing on it. --This would ordinarily be frustratingly entangled, but would you look at that, I'm using the ~observer pattern~ to decouple it! Look, teach, I paid attention! --Never mind that I'm the one who presented on it, thereby necessitating that I pay attention. spr(266,screenPositions[currentPlatform.position],85,0,1,0,0,2,3) --sends a message if and only if the platform was not rising last frame. if (prevModulatedTime <= platformTiming + nonTransitionWindow + platformDuration) then notif = {notifType = "platformRising", info = currentPlatform.position} table.insert(notifications,notif) end elseif ((modulatedTime > platformTiming - platformWindow and modulatedTime < platformTiming) or modulatedTime > doubleWholeNote + negativeOffset) then --This is the case in which the platform is in a transition frame (going down). spr(262,screenPositions[currentPlatform.position],85,0,1,0,0,2,3) --sends a message if and only if the platform was not falling last frame. if (prevModulatedTime <= platformTiming - nonTransitionWindow or prevModulatedTime <= doubleWholeNote + negativeOffset) then notif = {notifType = "platformFalling", info = currentPlatform.position} table.insert(notifications,notif) end else --This is the case in which the platform is raised. spr(260,screenPositions[currentPlatform.position],85,0,1,0,0,2,3) end end end function checkForPlayerInput() if(btnp(6) or keyp(10)) then dash(1) elseif(btnp(7) or keyp(11)) then dash(2) end if(btnp(0) or keyp(4)) then jump() end end function dash(distance) beatTiming = beats[currentBeatIndex].timing*sixteenthNote if(modulatedTime < beatTiming + forgivenessWindow and modulatedTime > beatTiming - forgivenessWindow and playerState == 0) then --breaks the beat (this causes its behavior in updateBeats to change). beats[currentBeatIndex].breakTime = currentTime beats[currentBeatIndex].active = false if((distance == 1 and beats[currentBeatIndex].size == 2) or (distance == 2 and beats[currentBeatIndex].size == 1)) then --case in which the player pressed the wrong button for the beat. killPlayer() else notif = {notifType = "playerDashing", info = distance} table.insert(notifications,notif) dashStartXPos = playerPosition playerPosition = playerPosition + distance startPos = screenPositions[dashStartXPos] endPos = screenPositions[playerPosition] playerState = 1 distance = endPos-startPos dashStartTime = currentTime dashSpeed = distance/dashTime end end end function jump() if(playerState==0) then for index = 1, #jumpBeats, 1 do if (modulatedTime < jumpBeats[index]*sixteenthNote + 2*(forgivenessWindow/3) and modulatedTime > jumpBeats[index]*sixteenthNote - 2*(forgivenessWindow/3)) then notif = {notifType = "playerJumped", info = playerPosition} table.insert(notifications,notif) jumpStartTime = currentTime playerState = 5 end end end end function updatePlayer() if(playerState == 0) then --this is the case where the player is standing. if(currentTime < dashStartTime + dashTime + dashRecoverTime) then if(playerPosition - dashStartXPos == 1) then drawDashLine(5) else drawDashLine(10) end spr(334,playerX,playerY,0,1,0,0,2,2) else if currentTime%quarterNote < forgivenessWindow or currentTime%quarterNote > quarterNote-forgivenessWindow then spr(302,playerX,playerY,0,1,0,0,2,2) else spr(258,playerX,playerY,0,1,0,0,2,2) end end elseif(playerState == 1) then --this is the case where the player is dashing. if(currentTime >= dashStartTime + dashTime) then --ends the dash. playerState = 0 playerX = screenPositions[playerPosition] if(playerPosition == 7) then room = room+1 if room > 50 then room = 1 end initScreenWipe("left",10,15,room,1) playerState = 3 else for index = 1, #platforms, 1 do --in the case where the platform the player has landed on has already re-ascended (i.e. is back in its up position), kill the player. --also, kill the player if they land on a space without a platform. if(platforms[index].position == playerPosition and modulatedTime > platforms[index].timing*sixteenthNote + platforms[index].duration*sixteenthNote) then killPlayer() end end end else playerX = screenPositions[dashStartXPos] + (currentTime - dashStartTime)*dashSpeed if(playerPosition - dashStartXPos == 1) then drawDashLine(5) spr(268,playerX,playerY,0,1,0,0,2,2) else drawDashLine(10) spr(270,playerX,playerY,0,1,0,0,2,2) end end elseif(playerState == 2) then --this is the case where the player is actively in the process of dying (mid-death-animation). die() elseif(playerState == 3) then --this is the case where the player is inactive (idling and cannot be controlled). if currentTime%quarterNote < forgivenessWindow or currentTime%quarterNote > quarterNote-forgivenessWindow then spr(302,playerX,playerY,0,1,0,0,2,2) else spr(258,playerX,playerY,0,1,0,0,2,2) end elseif(playerState == 5) then --this is the case where the player is jumping upwards. if(currentTime >= jumpStartTime + jumpTime) then --ends the jump. playerState = 6 playerY = playerDefaultY-jumpHeight else playerY = playerDefaultY - (currentTime - jumpStartTime)*jumpSpeed spr(430,playerX,playerY,0,1,0,0,2,2) end elseif(playerState == 6) then playerY = playerY + (currentTime%eighthNote - eighthNote/2)/40 spr(462,playerX,playerY,0,1,0,0,2,2) for index = 1, #jumpBeats, 1 do if ((modulatedTime > jumpBeats[index]*sixteenthNote - jumpTime and modulatedTime < jumpBeats[index]*sixteenthNote) or modulatedTime > 18*sixteenthNote - jumpTime) then jumpStartTime = currentTime playerState = 7 playerY = playerDefaultY-jumpHeight end end elseif(playerState == 7) then --this is the case where the player is falling. if(currentTime >= jumpStartTime + jumpTime) then --ends the jump. playerState = 0 playerY = playerDefaultY else playerY = playerDefaultY - (jumpHeight -(currentTime - jumpStartTime)*jumpSpeed) spr(288,playerX,playerY,0,1,0,0,2,2) end end --the player, as a makeshift observer, has access to the "notifications" pool. for index = 1, #notifications, 1 do if(notifications[index].notifType == "platformRising" and notifications[index].info == playerPosition and (playerState == 0 or playerState == 5 or playerState == 6 or playerState==7)) then killPlayer() end end end --Draws a dash trail behind the player as they dash, and is the coolest shit in this godforsaken lua file. Iterates over the distance between --the start of the dash and the player, drawing progressively longer lines, and also shifts everything by an amount determined by how --long it's been since the player started dashing, causing the particles to appear to drift to the right after they appear. function drawDashLine(color) i = screenPositions[dashStartXPos] j = i d = 0 while i + 2 + d + (currentTime-dashStartTime)/20 < playerX + 8 do i = i + 2 + d i = i + (currentTime-dashStartTime)/20 j = j + (currentTime-dashStartTime)/20 rect(j,playerY+8,i-j,1,color) i = i + 2 j = i d = d + 3 end end function die() if(currentTime > deathStartTime + deathTime*8) then notif = {notifType = "playerExploded", info = 0} table.insert(notifications,notif) initScreenWipe("down",8,3,room,1) playerState = 4 elseif(currentTime > deathStartTime + deathTime*7) then spr(391,playerX-4,playerY-4,0,1,0,0,3,3) elseif(currentTime > deathStartTime + deathTime*6) then spr(388,playerX-4,playerY-4,0,1,0,0,3,3) elseif(currentTime > deathStartTime + deathTime*3) then spr(398,playerX,playerY,0,1,0,0,2,2) elseif(currentTime > deathStartTime + deathTime*2) then spr(396,playerX,playerY,0,1,0,0,2,2) elseif(currentTime > deathStartTime + deathTime) then spr(366,playerX,playerY,0,1,0,0,2,2) else spr(364,playerX,playerY,0,1,0,0,2,2) end end function initScreenWipe(direction,speed,color,wroom,gamestate) rectX = 0 rectY = 0 rectWidth = 0 rectHeight = 0 if direction == "up" then rectY = 136 rectWidth = 240 elseif direction == "right" then rectHeight = 136 elseif direction == "down" then rectWidth = 240 elseif direction == "left" then rectX = 240 rectHeight = 136 end wipeDirection = direction wipeSpeed = speed wipeColor = color wipeProgress = 0 wipeRoom = wroom wipeGameState = gamestate wipePauseTimer = wipePauseDuration end function screenWipe(direction,speed,color,wroom,gamestate) if(wipeProgress == 0) then if direction == "up" then rectY = rectY - speed rectHeight = rectHeight + speed if(rectY < 0) then wipeProgress = 1 end elseif direction == "right" then rectWidth = rectWidth + speed if(rectWidth > 240) then wipeProgress = 1 end elseif direction == "down" then rectHeight = rectHeight + speed if(rectHeight > 136) then wipeProgress = 1 end elseif direction == "left" then rectX = rectX - speed rectWidth = rectWidth + speed if(rectX < 0) then wipeProgress = 1 end end rect(rectX,rectY,rectWidth,rectHeight,wipeColor) elseif(wipeProgress == 1) then if(treasurePosition < 0 and playerPosition ~= 7) then treasurePosition = -treasurePosition numTreasures = numTreasures - 1 end playerPosition = 1 playerX = screenPositions[playerPosition] playerY = playerDefaultY playerState = 3 initRoom(wroom) gameState = gamestate currentBeatIndex = 1 if(wipePauseTimer > 0) then wipePauseTimer = wipePauseTimer - 1 else wipeProgress = 2 end rect(rectX,rectY,rectWidth,rectHeight,wipeColor) elseif(wipeProgress == 2) then if direction == "up" then rectHeight = rectHeight - speed if(rectHeight < 0) then wipeProgress = 3 end elseif direction == "right" then rectWidth = rectWidth - speed rectX = rectX - speed if(rectWidth < 0) then wipeProgress = 3 end elseif direction == "down" then rectHeight = rectHeight - speed rectY = rectY + speed if(rectHeight < 0) then wipeProgress = 3 end elseif direction == "left" then rectWidth = rectWidth - speed if(rectWidth < 0) then wipeProgress = 3 end end rect(rectX,rectY,rectWidth,rectHeight,wipeColor) elseif(wipeProgress == 3) then playerState = 0 wipeProgress = -1 end end function drawMap() map(0,0,240,136) mapX = 0 mapY = 0 --picks new tiles at the beginning of each new quarter note. if(prevTime%eighthNote > currentTime%eighthNote) then --animate the top layer of water mapY = 12 for mapX = 4, 25, 1 do mset(mapX,mapY,14 + math.random(0,1)) end --animate the two layers of water just above the bottom. for mapY = 14, 15, 1 do for mapX = 4, 25, 1 do mset(mapX,mapY,16 + math.random(0,4)) end end --animate the bottom layer of water. mapY = 16 for mapX = 4, 25, 1 do mset(mapX,mapY,21 + math.random(0,3)) end end end function killPlayer() playerState = 2 deathStartTime = currentTime notif = {notifType = "playerCrystallized", info = 0} table.insert(notifications,notif) end --The audio acts as an observer and gets access to the notification pool. function handleAudio() if(sfxCooldown > 0) then sfxCooldown = sfxCooldown-1 end for index = 1, #notifications, 1 do if(notifications[index].notifType == "playerDashing") then sfx(-1,"D-5",10,0,12,0) sfx(1,"D-5",10,0,10,0) if(notifications[index].info == 2) then sfx(9,"F#8",15,3,13,0) else sfx(9,"E-8",15,3,10,0) end sfxCooldown = 10 elseif(notifications[index].notifType == "platformRising" and sfxCooldown == 0) then sfx(4,"A#4",10,0,5,0) elseif(notifications[index].notifType == "platformFalling" and sfxCooldown == 0) then sfx(3,"G#5",10,0,5,0) elseif(notifications[index].notifType == "playerCrystallized") then sfx(10,"A#1",-1,2,10,0) elseif(notifications[index].notifType == "playerExploded") then sfxCooldown=10 sfx(-1,"A#1",-1,2,10,0) sfx(-1,"A#1",-1,0,10,0) sfx(-1,"A#1",-1,3,10,0) sfx(11,"B-4",10,3,10,0) sfx(1,"A-3",10,0,10,0) elseif(notifications[index].notifType == "treasureCollected") then sfx(14,"A-4",15,3,10,0) elseif(notifications[index].notifType == "playerJumped") then sfx(15,"B-5",10,3,15,0) elseif(notifications[index].notifType == "gameBeat") then sfx(-1,"B-5",10,0,15,0) sfx(-1,"B-5",10,1,15,0) sfx(-1,"B-5",10,2,15,0) sfx(-1,"B-5",10,3,15,0) music() end end end function drawTreasureCounter(x,y,spacing) drawX = x for index = 1, targetNumTreasures, 1 do if(numTreasures >= index) then spr(433,drawX,y,0,1,0,0,1,2) else spr(432,drawX,y,0,1,0,0,1,2) end drawX = drawX + spacing end end function drawUI() drawBeatMap(beatMapX,beatMapY,beatMapLength) drawTreasureCounter(5,5,10) end function initGame() for index = 1, 50, 1 do roomDetails = {platformConfig = math.random(1,#platformConfigurations), treasurePlacement = 0} table.insert(rooms,roomDetails) --Add treasure to every fifth room, but only at positions where it's possible to obtain. if(index%5 == 0) then while rooms[index].treasurePlacement == 0 do possibleIndices = {} rooms[index].platformConfig = math.random(1,#platformConfigurations) roomPlatforms = platformConfigurations[rooms[index].platformConfig] for i = 1, #roomPlatforms do if roomPlatforms[i].duration >= 4 then table.insert(possibleIndices,roomPlatforms[i].position) end end if #possibleIndices ~= 0 then rooms[index].treasurePlacement = possibleIndices[math.random(1,#possibleIndices)] end end end end rooms[1].platformConfig = 1 initRoom(1) music(1,-1,-1,true,false,bpm,-1) end function updateTreasure() if(treasurePosition > 0) then treasureY = playerDefaultY - jumpHeight treasureX = screenPositions[treasurePosition] + 1 drawTreasure(treasureX,treasureY) end if(playerPosition == treasurePosition and playerState == 6) then numTreasures = numTreasures+1 treasurePosition = -treasurePosition notif = {notifType = "treasureCollected", info = treasurePosition} table.insert(notifications,notif) if(numTreasures >= targetNumTreasures) then endGame() end end end function endGame() initScreenWipe("right",8,11,3,3) notif = {notifType = "gameBeat", info = 0} table.insert(notifications,notif) playerState = 3 end function drawTreasure(x,y) treasureY = y - (currentTime%quarterNote-(quarterNote/2))/100 - 5 animStep = 50 if(modulatedTime%wholeNote > animStep*4) then --do nothing elseif(modulatedTime%wholeNote > animStep*3) then spr(458,x,treasureY,0,1,0,0,2,2) elseif(modulatedTime%wholeNote > animStep*2) then spr(426,x,treasureY,0,1,0,0,2,2) elseif(modulatedTime%wholeNote > animStep*1) then spr(330,x,treasureY,0,1,0,0,2,2) else spr(394,x,treasureY,0,1,0,0,2,2) end spr(362,x,treasureY,0,1,0,0,2,2) end function initRoom(room) initPlatforms(rooms[room].platformConfig) treasurePosition = rooms[room].treasurePlacement end function updateTitleScreen() cls(0) spr(160,0,17,0,2,0,0,16,6) rectb(0,7,240,99,4) print("Press J to start",70,115,9, 2) if(btnp(4)) then initScreenWipe("up",8,15,1,2) end end function updateInstructionsScreen() cls(0) print("Press the corresponding button when the",5,5,9) print("gem overlaps the target to dash!",5,13,9) spr(290,0,30,0,1,0,0,2,2) print("J = short dash",23,35,9) spr(300,120,30,0,1,0,0,2,2) print("K = long dash",145,35,1,9) print("Collect "..targetNumTreasures.." treasures to win!",5,60,9) drawTreasure(172,59) print("To reach the treasure, use the D key",5,78,9) print("to jump on sixteenth notes!",5,86,9) spr(309,170,85,0,1,0,0,1,1) print("Move in time with the beat...",5,107,4) print("or suffer the cavern's curse!",5,115,4) if(btnp(4)) then initScreenWipe("up",8,14,1,1) end end function updateVictoryScreen() cls(0) spr(64,-16,17,0,2,0,0,16,6) print("Expedition",8,51,6,false,2) print("success!",11,65,6,false,2) end initGame() function TIC() prevTime = currentTime currentTime = time() + 33 prevModulatedTime = prevTime%doubleWholeNote modulatedTime = currentTime%doubleWholeNote if(gameState == 0) then updateTitleScreen() elseif(gameState == 1) then cls(0) drawMap() checkForPlayerInput() updatePlatforms() updatePlayer() drawUI() updateBeats() updateTreasure() handleAudio() elseif(gameState == 2) then updateInstructionsScreen() elseif(gameState == 3) then updateVictoryScreen() end screenWipe(wipeDirection,wipeSpeed,wipeColor,wipeRoom,wipeGameState) notifications = {} end