-var SlopeBlockClass = function(ownerStage, args)
-{
- SlopeBlockClass.base.apply(this, arguments);
-
- var colLH = args[1], colRH = args[2];
-
- this.collisionLeftHeight = colLH; //\8d¶\8fã\82©\82ç\95Ó\82è\94»\92è\97Ì\88æ\82Ü\82Å\82Ì\8d\82\82³
- this.collisionRightHeight = colRH; //\89E\8fã\82©\82ç\95Ó\82è\94»\92è\97Ì\88æ\82Ü\82Å\82Ì\8d\82\82³
-
- //\83f\83o\83b\83O\8fî\95ñ\82ð\89æ\96Ê\82É\95\\8e¦
- this.enableDebugMode = false;
-
- //\83f\83o\83b\83O\8fî\95ñ
- this.x1 = 0;
- this.x2 = 0;
- this.y2 = 0;
-
-}.extend(BlockClass, {
- isOverlappedWith: function(x1, y1, x2, y2){
- // 1 - - +
- // | |
- // | |
- // + - - 2
- //\83I\83u\83W\83F\83N\83g\96{\91Ì\95\94\95ª\82É\8fd\82È\82é\82©\82Ç\82¤\82©\82ð\92²\82×\82é
- //\82±\82Ì\8aÖ\90\94\82ªfalse\82ð\95Ô\82µ\82½\8e\9e\82Ì\88ø\90\94\82Ì\94Í\88Í\82Ö\82Í\83I\83u\83W\83F\83N\83g\82ª\88Ú\93®\82Å\82«\82é\81B
- //true\82©\82ÂisPhantom==false\82Ì\8e\9e\82Í\8fÕ\93Ë\82·\82é\81B
-
- //\83f\83o\83b\83O\8fî\95ñ
- this.x1 = x1;
- this.y2 = y2;
- this.x2 = x2;
-
- if(this.collisionLeftHeight != this.collisionRightHeight){
- return this.crossLineJudge(x1, y2 - 1, x2, y2 - 1,
- this.origin.x, this.origin.y + this.collisionLeftHeight,
- this.origin.x + this.size.x - 1, this.origin.y + this.collisionRightHeight);
- }
- //\83`\83F\83b\83N\82·\82é\93ñ\82Â\82Ì\90ü\95ª\82ª\95½\8ds\82¾\82Æ\93\96\82½\82è\94»\92è\82É\98R\82ê\82é\82Ì\82Å\81A\93\96\82½\82è\94»\92è\82ª\90\85\95½\82È\8fê\8d\87\82Í\91¼\82Ì\8e®\82ð\97\98\97p\82·\82é\81B
- if(this.collisionLeftHeight >= this.size.y){
- return false;
- }
- return (x2 > (this.origin.x + this.collisionMargin.left)) &&
- (x1 <= (this.origin.x + this.size.x - this.collisionMargin.right)) &&
- (y2 > (this.origin.y + this.collisionMargin.top + this.collisionLeftHeight)) &&
- (y1 <= (this.origin.y + this.size.y - this.collisionMargin.bottom));
- },
- //\8dÀ\95W p1,p2 \82ð\8c\8b\82Ô\90ü\95ª\82Æ\8dÀ\95W q1,q2 \82ð\8c\8b\82Ô\90ü\95ª\82ª\8cð\8d·\82µ\82Ä\82¢\82é\82©\82ð\92²\82×\82é
- //\82½\82¾\82µ\81A\90ü\95ª\82ª\8fd\82È\82Á\82Ä\82¢\82é\8fê\8d\87(3\93_,4\93_\82ª\88ê\92¼\90ü\8fã\82É\82 \82é)\81A\81u\8cð\8d·\82µ\82Ä\82¢\82é\81v\81A\82Æ\94»\92è\82µ\82Ü\82·\81B
- crossLineJudge: function(p1x, p1y, p2x, p2y, q1x, q1y, q2x, q2y){
- if(p1x >= p2x){
- if((p1x < q1x && p1x < q2x) || (p2x > q1x && p2x > q2x)){
- return false;
- }
- } else{
- if((p2x < q1x && p2x < q2x) || (p1x > q1x && p1x > q2x)){
- return false;
- }
- }
- if(p1y >= p2y){
- if((p1y < q1y && p1y < q2y) || (p2y > q1y && p2y > q2y)){
- return false;
- }
- } else{
- if((p2y < q1y && p2y < q2y) || (p1y > q1y && p1y > q2y)){
- return false;
- }
- }
- return !((((p1x - p2x)*(q1y-p1y)+(p1y-p2y)*(p1x-q1x))*((p1x-p2x)*(q2y-p1y)+(p1y-p2y)*(p1x-q2x))>0) ||
- (((q1x - q2x)*(p1y-q1y)+(q1y-q2y)*(q1x-p1x))*((q1x-q2x)*(p2y-q1y)+(q1y-q2y)*(q1x-p2x))>0));
- //\8eQ\8dl http://www5d.biglobe.ne.jp/~tomoya03/shtml/algorithm/IntersectionEX.htm
- },
- draw : function(x, y){
- SlopeBlockClass.base.prototype.draw.apply(this, arguments);
- /*
- if(this.enableDebugMode)
- {
- var xz = this.origin.x - x;
- this.ownerStage.mainContext.save();
- this.ownerStage.mainContext.beginPath();
- this.ownerStage.mainContext.strokeStyle='#0000ff';
- this.ownerStage.mainContext.moveTo(x,y + this.collisionLeftHeight);
- this.ownerStage.mainContext.lineTo(x + this.size.x + 1,y + this.collisionRightHeight);
- this.ownerStage.mainContext.stroke();
- this.ownerStage.mainContext.beginPath();
- this.ownerStage.mainContext.strokeStyle='#ff0000';
- this.ownerStage.mainContext.moveTo(this.x1 - xz,this.y2);
- this.ownerStage.mainContext.lineTo(this.x2 - xz,this.y2);
- this.ownerStage.mainContext.stroke();
- this.ownerStage.mainContext.restore();
- }
- */
- },
- debugDraw: function(x, y){
- var xz = this.origin.x - x;
-
- if(this.collisionLeftHeight < this.size.y && this.collisionRightHeight < this.size.y){
- this.ownerStage.collisionMapContext.beginPath();
- this.ownerStage.collisionMapContext.moveTo(x, y + this.collisionLeftHeight);
- this.ownerStage.collisionMapContext.lineTo(x + this.size.x, y + this.collisionRightHeight);
- this.ownerStage.collisionMapContext.lineTo(x + this.size.x, y + this.size.y);
- this.ownerStage.collisionMapContext.lineTo(x, y + this.size.y);
- this.ownerStage.collisionMapContext.closePath();
- this.ownerStage.collisionMapContext.stroke();
- } else{
- this.ownerStage.collisionMapContext.beginPath();
- this.ownerStage.collisionMapContext.moveTo(x, y + this.collisionLeftHeight);
- this.ownerStage.collisionMapContext.lineTo(x + this.size.x, y + this.collisionRightHeight);
- this.ownerStage.collisionMapContext.stroke();
- }
- }
-});
-//\82±\82Ì\83N\83\89\83X\82Ì\83C\83\93\83X\83^\83\93\83X\82Ìtick\82ð\8cÄ\82Ñ\8fo\82³\82È\82¢\82æ\82¤\82É\90Ý\92è\81i\8d\82\91¬\89»\81j
-SlopeBlockClass.tick = function(){return false;};
+var SlopeBlockClass = function(ownerStage, args)\r
+{\r
+ SlopeBlockClass.base.apply(this, arguments);\r
+ \r
+ var colLH = args[1], colRH = args[2];\r
+ \r
+ this.collisionLeftHeight = colLH; //\8d¶\8fã\82©\82ç\95Ó\82è\94»\92è\97Ì\88æ\82Ü\82Å\82Ì\8d\82\82³\r
+ this.collisionRightHeight = colRH; //\89E\8fã\82©\82ç\95Ó\82è\94»\92è\97Ì\88æ\82Ü\82Å\82Ì\8d\82\82³\r
+ \r
+ //\83f\83o\83b\83O\8fî\95ñ\82ð\89æ\96Ê\82É\95\\8e¦\r
+ this.enableDebugMode = false;\r
+ \r
+ //\83f\83o\83b\83O\8fî\95ñ\r
+ this.x1 = 0;\r
+ this.x2 = 0;\r
+ this.y2 = 0;\r
+ \r
+}.extend(BlockClass, {\r
+ isOverlappedWith: function(x1, y1, x2, y2){\r
+ // 1 - - +\r
+ // | |\r
+ // | |\r
+ // + - - 2\r
+ //\83I\83u\83W\83F\83N\83g\96{\91Ì\95\94\95ª\82É\8fd\82È\82é\82©\82Ç\82¤\82©\82ð\92²\82×\82é\r
+ //\82±\82Ì\8aÖ\90\94\82ªfalse\82ð\95Ô\82µ\82½\8e\9e\82Ì\88ø\90\94\82Ì\94Í\88Í\82Ö\82Í\83I\83u\83W\83F\83N\83g\82ª\88Ú\93®\82Å\82«\82é\81B\r
+ //true\82©\82ÂisPhantom==false\82Ì\8e\9e\82Í\8fÕ\93Ë\82·\82é\81B\r
+ \r
+ //\83f\83o\83b\83O\8fî\95ñ\r
+ this.x1 = x1;\r
+ this.y2 = y2;\r
+ this.x2 = x2;\r
+ \r
+ if(this.collisionLeftHeight != this.collisionRightHeight){\r
+ return this.crossLineJudge(x1, y2 - 1, x2, y2 - 1,\r
+ this.origin.x, this.origin.y + this.collisionLeftHeight,\r
+ this.origin.x + this.size.x - 1, this.origin.y + this.collisionRightHeight);\r
+ }\r
+ //\83`\83F\83b\83N\82·\82é\93ñ\82Â\82Ì\90ü\95ª\82ª\95½\8ds\82¾\82Æ\93\96\82½\82è\94»\92è\82É\98R\82ê\82é\82Ì\82Å\81A\93\96\82½\82è\94»\92è\82ª\90\85\95½\82È\8fê\8d\87\82Í\91¼\82Ì\8e®\82ð\97\98\97p\82·\82é\81B\r
+ if(this.collisionLeftHeight >= this.size.y){\r
+ return false;\r
+ }\r
+ return (x2 > (this.origin.x + this.collisionMargin.left)) &&\r
+ (x1 <= (this.origin.x + this.size.x - this.collisionMargin.right)) &&\r
+ (y2 > (this.origin.y + this.collisionMargin.top + this.collisionLeftHeight)) &&\r
+ (y1 <= (this.origin.y + this.size.y - this.collisionMargin.bottom));\r
+ },\r
+ //\8dÀ\95W p1,p2 \82ð\8c\8b\82Ô\90ü\95ª\82Æ\8dÀ\95W q1,q2 \82ð\8c\8b\82Ô\90ü\95ª\82ª\8cð\8d·\82µ\82Ä\82¢\82é\82©\82ð\92²\82×\82é\r
+ //\82½\82¾\82µ\81A\90ü\95ª\82ª\8fd\82È\82Á\82Ä\82¢\82é\8fê\8d\87(3\93_,4\93_\82ª\88ê\92¼\90ü\8fã\82É\82 \82é)\81A\81u\8cð\8d·\82µ\82Ä\82¢\82é\81v\81A\82Æ\94»\92è\82µ\82Ü\82·\81B\r
+ crossLineJudge: function(p1x, p1y, p2x, p2y, q1x, q1y, q2x, q2y){\r
+ if(p1x >= p2x){\r
+ if((p1x < q1x && p1x < q2x) || (p2x > q1x && p2x > q2x)){\r
+ return false;\r
+ }\r
+ } else{\r
+ if((p2x < q1x && p2x < q2x) || (p1x > q1x && p1x > q2x)){\r
+ return false;\r
+ }\r
+ }\r
+ if(p1y >= p2y){\r
+ if((p1y < q1y && p1y < q2y) || (p2y > q1y && p2y > q2y)){\r
+ return false;\r
+ }\r
+ } else{\r
+ if((p2y < q1y && p2y < q2y) || (p1y > q1y && p1y > q2y)){\r
+ return false;\r
+ }\r
+ }\r
+ return !((((p1x - p2x)*(q1y-p1y)+(p1y-p2y)*(p1x-q1x))*((p1x-p2x)*(q2y-p1y)+(p1y-p2y)*(p1x-q2x))>0) ||\r
+ (((q1x - q2x)*(p1y-q1y)+(q1y-q2y)*(q1x-p1x))*((q1x-q2x)*(p2y-q1y)+(q1y-q2y)*(q1x-p2x))>0));\r
+ //\8eQ\8dl http://www5d.biglobe.ne.jp/~tomoya03/shtml/algorithm/IntersectionEX.htm\r
+ },\r
+ draw : function(x, y){\r
+ SlopeBlockClass.base.prototype.draw.apply(this, arguments);\r
+ /*\r
+ if(this.enableDebugMode)\r
+ {\r
+ var xz = this.origin.x - x;\r
+ this.ownerStage.mainContext.save();\r
+ this.ownerStage.mainContext.beginPath();\r
+ this.ownerStage.mainContext.strokeStyle='#0000ff';\r
+ this.ownerStage.mainContext.moveTo(x,y + this.collisionLeftHeight);\r
+ this.ownerStage.mainContext.lineTo(x + this.size.x + 1,y + this.collisionRightHeight);\r
+ this.ownerStage.mainContext.stroke();\r
+ this.ownerStage.mainContext.beginPath();\r
+ this.ownerStage.mainContext.strokeStyle='#ff0000';\r
+ this.ownerStage.mainContext.moveTo(this.x1 - xz,this.y2);\r
+ this.ownerStage.mainContext.lineTo(this.x2 - xz,this.y2);\r
+ this.ownerStage.mainContext.stroke();\r
+ this.ownerStage.mainContext.restore();\r
+ }\r
+ */\r
+ },\r
+ debugDraw: function(x, y){\r
+ var xz = this.origin.x - x;\r
+ \r
+ if(this.collisionLeftHeight < this.size.y && this.collisionRightHeight < this.size.y){\r
+ this.ownerStage.collisionMapContext.beginPath();\r
+ this.ownerStage.collisionMapContext.moveTo(x, y + this.collisionLeftHeight);\r
+ this.ownerStage.collisionMapContext.lineTo(x + this.size.x, y + this.collisionRightHeight);\r
+ this.ownerStage.collisionMapContext.lineTo(x + this.size.x, y + this.size.y);\r
+ this.ownerStage.collisionMapContext.lineTo(x, y + this.size.y);\r
+ this.ownerStage.collisionMapContext.closePath();\r
+ this.ownerStage.collisionMapContext.stroke();\r
+ } else{\r
+ this.ownerStage.collisionMapContext.beginPath();\r
+ this.ownerStage.collisionMapContext.moveTo(x, y + this.collisionLeftHeight);\r
+ this.ownerStage.collisionMapContext.lineTo(x + this.size.x, y + this.collisionRightHeight);\r
+ this.ownerStage.collisionMapContext.stroke();\r
+ }\r
+ }\r
+});\r
+//\82±\82Ì\83N\83\89\83X\82Ì\83C\83\93\83X\83^\83\93\83X\82Ìtick\82ð\8cÄ\82Ñ\8fo\82³\82È\82¢\82æ\82¤\82É\90Ý\92è\81i\8d\82\91¬\89»\81j\r
+SlopeBlockClass.tick = function(){return false;};\r