Merge pull request #18 from rsninja722/transition1

Transition 2
This commit is contained in:
rsninja722 2020-04-19 12:47:09 -04:00 committed by GitHub
commit 7adfb2f735
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 4 deletions

View File

@ -42,7 +42,7 @@ function update() {
break;
// level transition
case globalStates.levelTransition:
handleTransition();
break;
// playing
case globalStates.playing:
@ -79,7 +79,8 @@ function draw() {
break;
// level transition
case globalStates.levelTransition:
handleTransition();
drawLevelTransitionUI();
break;
// playing
case globalStates.playing:
@ -109,7 +110,6 @@ function absoluteDraw() {
break;
// level transition
case globalStates.levelTransition:
drawLevelTransitionUI();
break;
// playing
case globalStates.playing:

View File

@ -10,6 +10,20 @@ function handleTransition(){
}
centerCameraOn(constants.player.defaultX, constants.player.defaultY);
if(camera.x > 898) {
camera.x = 898;
}
if(camera.x < -98) {
camera.x = -98;
}
if(camera.y < 245) {
camera.y = 245;
}
if(camera.y > 350) {
camera.y = 350;
}
}
@ -17,7 +31,7 @@ function handleTransition(){
function drawLevelTransitionUI() {
// centers camera on player
centerCameraOn(constants.player.defaultX, constants.player.defaultY);
// sets alpha for background drawing
canvases.ctx.globalAlpha = 1;
@ -39,4 +53,5 @@ function drawLevelTransitionUI() {
// resets alpha for rest of drawing
canvases.ctx.globalAlpha = 1;
}