@@ -127,7 +127,7 @@ class Mario {
127127 else {
128128 if ( this . game . down ) // big mario is crouching
129129 this . BB = new BoundingBox ( this . x , this . y + PARAMS . BLOCKWIDTH , PARAMS . BLOCKWIDTH , PARAMS . BLOCKWIDTH ) ;
130- else
130+ else
131131 this . BB = new BoundingBox ( this . x , this . y , PARAMS . BLOCKWIDTH , PARAMS . BLOCKWIDTH * 2 ) ;
132132 }
133133 } ;
@@ -324,11 +324,11 @@ class Mario {
324324
325325 if ( this . game . A ) { // jump
326326 if ( Math . abs ( this . velocity . x ) < 16 ) {
327- this . velocity . y = - 240 ;
327+ this . velocity . y = - 280 ;
328328 this . fallAcc = STOP_FALL ;
329329 }
330330 else if ( Math . abs ( this . velocity . x ) < 40 ) {
331- this . velocity . y = - 240 ;
331+ this . velocity . y = - 280 ;
332332 this . fallAcc = WALK_FALL ;
333333 }
334334 else {
@@ -424,6 +424,13 @@ class Mario {
424424 // update position
425425 this . x += this . velocity . x * TICK * PARAMS . SCALE ;
426426 this . y += this . velocity . y * TICK * PARAMS . SCALE ;
427+
428+ // Apply left boundary constraint
429+ if ( this . x < this . game . camera . x ) {
430+ this . x = this . game . camera . x ;
431+ this . velocity . x = Math . max ( 0 , this . velocity . x ) ;
432+ }
433+
427434 this . updateLastBB ( ) ;
428435 this . updateBB ( ) ;
429436
@@ -519,7 +526,7 @@ class Mario {
519526 that . x = entity . BB . left - PARAMS . BLOCKWIDTH ;
520527 if ( that . velocity . x > 0 ) that . velocity . x = 0 ;
521528 if ( entity instanceof SideTube && that . game . right ) {
522- that . game . camera . loadLevel ( levelOne , 162.5 * PARAMS . BLOCKWIDTH , 11 * PARAMS . BLOCKWIDTH )
529+ that . game . camera . loadLevel ( levelOne , 162.5 * PARAMS . BLOCKWIDTH , 11 * PARAMS . BLOCKWIDTH )
523530 }
524531 } else if ( that . lastBB . left >= entity . BB . right ) { // Collided with the right
525532 that . x = entity . BB . right ;
0 commit comments