This repository has been archived on 2020-04-21. You can view files and clone it, but cannot push or open issues or pull requests.
2020-04-18 22:04:22 -04:00

43 lines
912 B
JavaScript

var currentAlpha = 1.01;
function handleTransition(){
// Calculates alpha until its zero
if(currentAlpha > 0){
currentAlpha -= .005;
}
}
// UI for level transition
function drawLevelTransitionUI() {
// centers camera on player
centerCameraOn(constants.player.defaultX, constants.player.defaultY);
// sets alpha for background drawing
canvases.ctx.globalAlpha = 1;
// draws background sprites
drawWorldBlocks();
imgIgnoreCutoff(sprites.level_2,0,0,0,4,4);
player.draw();
// sets alpha to calculated alpha for black
canvases.ctx.globalAlpha = currentAlpha;
// draw a black rect unless less the 0 alpha then switches to actual game
if(currentAlpha > 0){
rect(0, 0, 2000, 2000, "black");
}else{
globalState = globalStates.playing;
}
// resets alpha for rest of drawing
canvases.ctx.globalAlpha = 1;
}