@@ -182,26 +182,30 @@ Phaser.Plugin.ArcadeSlopes.TileSlopeFactory.prototype.calculateEdges = function
182
182
183
183
if ( above && above . hasOwnProperty ( 'slope' ) ) {
184
184
tile . slope . edges . top = this . compareEdges ( tile . slope . edges . top , above . slope . edges . bottom ) ;
185
+ tile . collideUp = tile . slope . edges . top !== Phaser . Plugin . ArcadeSlopes . TileSlope . EMPTY ;
185
186
}
186
187
187
188
if ( below && below . hasOwnProperty ( 'slope' ) ) {
188
189
tile . slope . edges . bottom = this . compareEdges ( tile . slope . edges . bottom , below . slope . edges . top ) ;
190
+ tile . collideDown = tile . slope . edges . bottom !== Phaser . Plugin . ArcadeSlopes . TileSlope . EMPTY ;
189
191
}
190
192
191
193
if ( left && left . hasOwnProperty ( 'slope' ) ) {
192
194
tile . slope . edges . left = this . compareEdges ( tile . slope . edges . left , left . slope . edges . right ) ;
195
+ tile . collideLeft = tile . slope . edges . left !== Phaser . Plugin . ArcadeSlopes . TileSlope . EMPTY ;
193
196
}
194
197
195
198
if ( right && right . hasOwnProperty ( 'slope' ) ) {
196
199
tile . slope . edges . right = this . compareEdges ( tile . slope . edges . right , right . slope . edges . left ) ;
200
+ tile . collideRight = tile . slope . edges . right !== Phaser . Plugin . ArcadeSlopes . TileSlope . EMPTY ;
197
201
}
198
202
}
199
203
}
200
204
}
201
205
} ;
202
206
203
207
/**
204
- * Resolve the given flags of two shared edges.
208
+ * Resolve the given flags of two shared tile edges.
205
209
*
206
210
* Returns the new flag to use for the first edge after comparing it with the
207
211
* second edge.
@@ -572,10 +576,10 @@ Phaser.Plugin.ArcadeSlopes.TileSlopeFactory.createQuarterBottomRightLow = functi
572
576
*/
573
577
Phaser . Plugin . ArcadeSlopes . TileSlopeFactory . createQuarterBottomRightHigh = function ( type , tile ) {
574
578
var polygon = new SAT . Polygon ( new SAT . Vector ( tile . worldX , tile . worldY ) , [
575
- new SAT . Vector ( tile . width , 0 ) , // Top right
576
- new SAT . Vector ( 0 , tile . height / 2 ) , // Center left
577
- new SAT . Vector ( 0 , tile . height ) , // Bottom left
578
- new SAT . Vector ( tile . width , tile . height ) // Bottom right
579
+ new SAT . Vector ( 0 , tile . height / 2 ) , // Center left
580
+ new SAT . Vector ( tile . width , 0 ) , // Top right
581
+ new SAT . Vector ( tile . width , tile . height ) , // Bottom right
582
+ new SAT . Vector ( 0 , tile . height ) // Bottom left
579
583
] ) ;
580
584
581
585
var line = new Phaser . Line ( tile . left , tile . bottom , tile . right , tile . top + tile . height / 2 ) ;
@@ -602,10 +606,10 @@ Phaser.Plugin.ArcadeSlopes.TileSlopeFactory.createQuarterBottomRightHigh = funct
602
606
*/
603
607
Phaser . Plugin . ArcadeSlopes . TileSlopeFactory . createQuarterLeftBottomLow = function ( type , tile ) {
604
608
var polygon = new SAT . Polygon ( new SAT . Vector ( tile . worldX , tile . worldY ) , [
605
- new SAT . Vector ( 0 , 0 ) ,
606
- new SAT . Vector ( tile . width / 2 , 0 ) ,
607
- new SAT . Vector ( tile . width , tile . height ) ,
608
- new SAT . Vector ( 0 , tile . height )
609
+ new SAT . Vector ( 0 , 0 ) , // Top left
610
+ new SAT . Vector ( tile . width / 2 , 0 ) , // Top center
611
+ new SAT . Vector ( tile . width , tile . height ) , // Bottom right
612
+ new SAT . Vector ( 0 , tile . height ) // Bottom left
609
613
] ) ;
610
614
611
615
var line = new Phaser . Line ( tile . left + tile . width / 2 , tile . top , tile . right , tile . bottom ) ;
@@ -631,9 +635,9 @@ Phaser.Plugin.ArcadeSlopes.TileSlopeFactory.createQuarterLeftBottomLow = functio
631
635
*/
632
636
Phaser . Plugin . ArcadeSlopes . TileSlopeFactory . createQuarterLeftBottomHigh = function ( type , tile ) {
633
637
var polygon = new SAT . Polygon ( new SAT . Vector ( tile . worldX , tile . worldY ) , [
634
- new SAT . Vector ( 0 , 0 ) ,
635
- new SAT . Vector ( tile . width / 2 , tile . height ) ,
636
- new SAT . Vector ( 0 , tile . height )
638
+ new SAT . Vector ( 0 , 0 ) , // Top left
639
+ new SAT . Vector ( tile . width / 2 , tile . height ) , // Bottom center
640
+ new SAT . Vector ( 0 , tile . height ) // Bottom left
637
641
] ) ;
638
642
639
643
var line = new Phaser . Line ( tile . left , tile . top , tile . left + tile . width / 2 , tile . bottom ) ;
@@ -661,10 +665,10 @@ Phaser.Plugin.ArcadeSlopes.TileSlopeFactory.createQuarterLeftBottomHigh = functi
661
665
*/
662
666
Phaser . Plugin . ArcadeSlopes . TileSlopeFactory . createQuarterRightBottomLow = function ( type , tile ) {
663
667
var polygon = new SAT . Polygon ( new SAT . Vector ( tile . worldX , tile . worldY ) , [
664
- new SAT . Vector ( tile . width / 2 , 0 ) ,
665
- new SAT . Vector ( tile . width , 0 ) ,
666
- new SAT . Vector ( tile . width , tile . height ) ,
667
- new SAT . Vector ( 0 , tile . height )
668
+ new SAT . Vector ( tile . width / 2 , 0 ) , // Top center
669
+ new SAT . Vector ( tile . width , 0 ) , // Top right
670
+ new SAT . Vector ( tile . width , tile . height ) , // Bottom right
671
+ new SAT . Vector ( 0 , tile . height ) // Bottom left
668
672
] ) ;
669
673
670
674
var line = new Phaser . Line ( tile . left , tile . bottom , tile . left + tile . width / 2 , tile . top ) ;
@@ -691,9 +695,9 @@ Phaser.Plugin.ArcadeSlopes.TileSlopeFactory.createQuarterRightBottomLow = functi
691
695
*/
692
696
Phaser . Plugin . ArcadeSlopes . TileSlopeFactory . createQuarterRightBottomHigh = function ( type , tile ) {
693
697
var polygon = new SAT . Polygon ( new SAT . Vector ( tile . worldX , tile . worldY ) , [
694
- new SAT . Vector ( tile . width , 0 ) ,
695
- new SAT . Vector ( tile . width , tile . height ) ,
696
- new SAT . Vector ( tile . width / 2 , tile . height )
698
+ new SAT . Vector ( tile . width , 0 ) , // Top right
699
+ new SAT . Vector ( tile . width , tile . height ) , // Bottom right
700
+ new SAT . Vector ( tile . width / 2 , tile . height ) // Bottom center
697
701
] ) ;
698
702
699
703
var line = new Phaser . Line ( tile . left + tile . width / 2 , tile . bottom , tile . right , tile . top ) ;
@@ -720,9 +724,9 @@ Phaser.Plugin.ArcadeSlopes.TileSlopeFactory.createQuarterRightBottomHigh = funct
720
724
*/
721
725
Phaser . Plugin . ArcadeSlopes . TileSlopeFactory . createQuarterLeftTopLow = function ( type , tile ) {
722
726
var polygon = new SAT . Polygon ( new SAT . Vector ( tile . worldX , tile . worldY ) , [
723
- new SAT . Vector ( 0 , 0 ) ,
724
- new SAT . Vector ( tile . width / 2 , 0 ) ,
725
- new SAT . Vector ( 0 , tile . height )
727
+ new SAT . Vector ( 0 , 0 ) , // Top left
728
+ new SAT . Vector ( tile . width / 2 , 0 ) , // Top center
729
+ new SAT . Vector ( 0 , tile . height ) // Bottom left
726
730
] ) ;
727
731
728
732
var line = new Phaser . Line ( 0 , tile . height , tile . width / 2 , 0 ) ;
@@ -749,10 +753,10 @@ Phaser.Plugin.ArcadeSlopes.TileSlopeFactory.createQuarterLeftTopLow = function (
749
753
*/
750
754
Phaser . Plugin . ArcadeSlopes . TileSlopeFactory . createQuarterLeftTopHigh = function ( type , tile ) {
751
755
var polygon = new SAT . Polygon ( new SAT . Vector ( tile . worldX , tile . worldY ) , [
752
- new SAT . Vector ( 0 , 0 ) ,
753
- new SAT . Vector ( tile . width , 0 ) ,
754
- new SAT . Vector ( tile . width / 2 , tile . height ) ,
755
- new SAT . Vector ( 0 , tile . height )
756
+ new SAT . Vector ( 0 , 0 ) , // Top left
757
+ new SAT . Vector ( tile . width , 0 ) , // Top right
758
+ new SAT . Vector ( tile . width / 2 , tile . height ) , // Bottom center
759
+ new SAT . Vector ( 0 , tile . height ) // Bottom left
756
760
] ) ;
757
761
758
762
var line = new Phaser . Line ( tile . left + tile . width / 2 , tile . bottom , tile . right , tile . bottom ) ;
@@ -778,9 +782,9 @@ Phaser.Plugin.ArcadeSlopes.TileSlopeFactory.createQuarterLeftTopHigh = function
778
782
*/
779
783
Phaser . Plugin . ArcadeSlopes . TileSlopeFactory . createQuarterRightTopLow = function ( type , tile ) {
780
784
var polygon = new SAT . Polygon ( new SAT . Vector ( tile . worldX , tile . worldY ) , [
781
- new SAT . Vector ( tile . width / 2 , 0 ) ,
782
- new SAT . Vector ( tile . width , 0 ) ,
783
- new SAT . Vector ( tile . width , tile . height )
785
+ new SAT . Vector ( tile . width / 2 , 0 ) , // Top center
786
+ new SAT . Vector ( tile . width , 0 ) , // Top right
787
+ new SAT . Vector ( tile . width , tile . height ) // Bottom right
784
788
] ) ;
785
789
786
790
var line = new Phaser . Line ( tile . left + tile . width / 2 , tile . top , tile . right , tile . bottom ) ;
@@ -807,10 +811,10 @@ Phaser.Plugin.ArcadeSlopes.TileSlopeFactory.createQuarterRightTopLow = function
807
811
*/
808
812
Phaser . Plugin . ArcadeSlopes . TileSlopeFactory . createQuarterRightTopHigh = function ( type , tile ) {
809
813
var polygon = new SAT . Polygon ( new SAT . Vector ( tile . worldX , tile . worldY ) , [
810
- new SAT . Vector ( 0 , 0 ) ,
811
- new SAT . Vector ( tile . width , 0 ) ,
812
- new SAT . Vector ( tile . width , tile . height ) ,
813
- new SAT . Vector ( tile . width / 2 , tile . height )
814
+ new SAT . Vector ( 0 , 0 ) , // Top left
815
+ new SAT . Vector ( tile . width , 0 ) , // Top right
816
+ new SAT . Vector ( tile . width , tile . height ) , // Bottom right
817
+ new SAT . Vector ( tile . width / 2 , tile . height ) // Center right
814
818
] ) ;
815
819
816
820
var line = new Phaser . Line ( tile . left , tile . top , tile . left + tile . width / 2 , tile . bottom ) ;
@@ -836,9 +840,9 @@ Phaser.Plugin.ArcadeSlopes.TileSlopeFactory.createQuarterRightTopHigh = function
836
840
*/
837
841
Phaser . Plugin . ArcadeSlopes . TileSlopeFactory . createQuarterTopLeftLow = function ( type , tile ) {
838
842
var polygon = new SAT . Polygon ( new SAT . Vector ( tile . worldX , tile . worldY ) , [
839
- new SAT . Vector ( 0 , 0 ) ,
840
- new SAT . Vector ( tile . width , 0 ) ,
841
- new SAT . Vector ( 0 , tile . height / 2 )
843
+ new SAT . Vector ( 0 , 0 ) , // Top left
844
+ new SAT . Vector ( tile . width , 0 ) , // Top right
845
+ new SAT . Vector ( 0 , tile . height / 2 ) // Center left
842
846
] ) ;
843
847
844
848
var line = new Phaser . Line ( tile . left , tile . top + tile . height / 2 , tile . right , tile . top ) ;
@@ -865,10 +869,10 @@ Phaser.Plugin.ArcadeSlopes.TileSlopeFactory.createQuarterTopLeftLow = function (
865
869
*/
866
870
Phaser . Plugin . ArcadeSlopes . TileSlopeFactory . createQuarterTopLeftHigh = function ( type , tile ) {
867
871
var polygon = new SAT . Polygon ( new SAT . Vector ( tile . worldX , tile . worldY ) , [
868
- new SAT . Vector ( 0 , 0 ) ,
869
- new SAT . Vector ( tile . width , 0 ) ,
870
- new SAT . Vector ( tile . width , tile . height / 2 ) ,
871
- new SAT . Vector ( 0 , tile . height )
872
+ new SAT . Vector ( 0 , 0 ) , // Top left
873
+ new SAT . Vector ( tile . width , 0 ) , // Top right
874
+ new SAT . Vector ( tile . width , tile . height / 2 ) , // Right center
875
+ new SAT . Vector ( 0 , tile . height ) // Bottom left
872
876
] ) ;
873
877
874
878
var line = new Phaser . Line ( tile . left , tile . bottom , tile . right , tile . top + tile . height / 2 ) ;
@@ -894,9 +898,9 @@ Phaser.Plugin.ArcadeSlopes.TileSlopeFactory.createQuarterTopLeftHigh = function
894
898
*/
895
899
Phaser . Plugin . ArcadeSlopes . TileSlopeFactory . createQuarterTopRightLow = function ( type , tile ) {
896
900
var polygon = new SAT . Polygon ( new SAT . Vector ( tile . worldX , tile . worldY ) , [
897
- new SAT . Vector ( 0 , 0 ) ,
898
- new SAT . Vector ( tile . width , 0 ) ,
899
- new SAT . Vector ( tile . width , tile . height / 2 )
901
+ new SAT . Vector ( 0 , 0 ) , // Top left
902
+ new SAT . Vector ( tile . width , 0 ) , // Top right
903
+ new SAT . Vector ( tile . width , tile . height / 2 ) // Right center
900
904
] ) ;
901
905
902
906
var line = new Phaser . Line ( tile . left , tile . top , tile . right , tile . top + tile . height / 2 ) ;
@@ -923,10 +927,10 @@ Phaser.Plugin.ArcadeSlopes.TileSlopeFactory.createQuarterTopRightLow = function
923
927
*/
924
928
Phaser . Plugin . ArcadeSlopes . TileSlopeFactory . createQuarterTopRightHigh = function ( type , tile ) {
925
929
var polygon = new SAT . Polygon ( new SAT . Vector ( tile . worldX , tile . worldY ) , [
926
- new SAT . Vector ( 0 , 0 ) ,
927
- new SAT . Vector ( tile . width , 0 ) ,
928
- new SAT . Vector ( tile . width , tile . height ) ,
929
- new SAT . Vector ( 0 , tile . height / 2 )
930
+ new SAT . Vector ( 0 , 0 ) , // Top left
931
+ new SAT . Vector ( tile . width , 0 ) , // Top right
932
+ new SAT . Vector ( tile . width , tile . height ) , // Bottom right
933
+ new SAT . Vector ( 0 , tile . height / 2 ) // Left center
930
934
] ) ;
931
935
932
936
var line = new Phaser . Line ( tile . left , tile . top + tile . height / 2 , tile . right , tile . top + tile . height ) ;
0 commit comments