@@ -127,7 +127,7 @@ class Mario {
127
127
else {
128
128
if ( this . game . down ) // big mario is crouching
129
129
this . BB = new BoundingBox ( this . x , this . y + PARAMS . BLOCKWIDTH , PARAMS . BLOCKWIDTH , PARAMS . BLOCKWIDTH ) ;
130
- else
130
+ else
131
131
this . BB = new BoundingBox ( this . x , this . y , PARAMS . BLOCKWIDTH , PARAMS . BLOCKWIDTH * 2 ) ;
132
132
}
133
133
} ;
@@ -324,11 +324,11 @@ class Mario {
324
324
325
325
if ( this . game . A ) { // jump
326
326
if ( Math . abs ( this . velocity . x ) < 16 ) {
327
- this . velocity . y = - 240 ;
327
+ this . velocity . y = - 280 ;
328
328
this . fallAcc = STOP_FALL ;
329
329
}
330
330
else if ( Math . abs ( this . velocity . x ) < 40 ) {
331
- this . velocity . y = - 240 ;
331
+ this . velocity . y = - 280 ;
332
332
this . fallAcc = WALK_FALL ;
333
333
}
334
334
else {
@@ -424,6 +424,13 @@ class Mario {
424
424
// update position
425
425
this . x += this . velocity . x * TICK * PARAMS . SCALE ;
426
426
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
+
427
434
this . updateLastBB ( ) ;
428
435
this . updateBB ( ) ;
429
436
@@ -519,7 +526,7 @@ class Mario {
519
526
that . x = entity . BB . left - PARAMS . BLOCKWIDTH ;
520
527
if ( that . velocity . x > 0 ) that . velocity . x = 0 ;
521
528
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 )
523
530
}
524
531
} else if ( that . lastBB . left >= entity . BB . right ) { // Collided with the right
525
532
that . x = entity . BB . right ;
0 commit comments