diff --git a/docs/assets/js/UI/ui.js b/docs/assets/js/UI/ui.js
index af05b4e..8bb34a7 100644
--- a/docs/assets/js/UI/ui.js
+++ b/docs/assets/js/UI/ui.js
@@ -2,9 +2,6 @@
function drawTitleScreenUI() {
}
-// UI for level transition
-function drawLevelTransitionUI() {
-}
// UI for playing
function drawPlayingUI() {
diff --git a/docs/assets/js/constants.js b/docs/assets/js/constants.js
index adf70aa..f2c99ce 100644
--- a/docs/assets/js/constants.js
+++ b/docs/assets/js/constants.js
@@ -56,7 +56,9 @@ var constants = {
hip: {
offset_x: 15,
offset_y: 25
- }
+ },
+ defaultX: 500,
+ defaultY: -70
}
};
\ No newline at end of file
diff --git a/docs/assets/js/index.js b/docs/assets/js/index.js
index 6ba2b74..87a7cfc 100644
--- a/docs/assets/js/index.js
+++ b/docs/assets/js/index.js
@@ -66,13 +66,14 @@ function draw() {
// Handle game state
switch (globalState) {
+
// title screen
case globalStates.titleScreen:
drawTitleScreen();
break;
// level transition
case globalStates.levelTransition:
-
+ handleTransition();
break;
// playing
case globalStates.playing:
diff --git a/docs/assets/js/player/player.js b/docs/assets/js/player/player.js
index cff22d4..2ce5929 100644
--- a/docs/assets/js/player/player.js
+++ b/docs/assets/js/player/player.js
@@ -259,7 +259,7 @@ function distanceToLineSegment(lx1, ly1, lx2, ly2, px, py) {
-var player = new Player(550,-70);
+var player = new Player(constants.player.defaultX, constants.player.defaultY);
// why does this stop the legs from glitching on the first step???
player.rightLeg.angle = -pointTo({ x: player.rightLeg.x2, y: player.rightLeg.y2 }, player.hipRight);
diff --git a/docs/assets/js/titleScreen/titleScreen.js b/docs/assets/js/titleScreen/titleScreen.js
index 3e8e08e..cbf91fc 100644
--- a/docs/assets/js/titleScreen/titleScreen.js
+++ b/docs/assets/js/titleScreen/titleScreen.js
@@ -24,7 +24,7 @@ function handleTitleScreen(){
function handleMainScreen(){
if(timer > 20){
if(rectpoint({x:415, y:200, w: 300, h: 50}, {x:cursor.x, y:cursor.y}) && mouseDown[0]){
- globalState = globalStates.playing;
+ globalState = globalStates.levelTransition;
timer = 0;
}
if(rectpoint({x:415, y:550, w: 300, h: 50}, {x:cursor.x, y:cursor.y}) && mouseDown[0]){
diff --git a/docs/assets/js/transition/transition.js b/docs/assets/js/transition/transition.js
new file mode 100644
index 0000000..b1d566f
--- /dev/null
+++ b/docs/assets/js/transition/transition.js
@@ -0,0 +1,42 @@
+
+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;
+}
diff --git a/docs/index.html b/docs/index.html
index a5bc7a2..6b7ceab 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -52,6 +52,7 @@ c: beat heart
+