-var HiddenBlockClass = function(ownerStage, args)
-{
- HiddenBlockClass.base.apply(this, arguments);
- var img = document.createElement('img');
- img.src = "images/" + args[0];
- //一時的に保存
- this.image0 = img;
- //画像はなし
- this.image = null;
-
- this.debugMode = true;
-
- this.isPhantom = true;
-
- //このフラグで立っているビットがすべて立っていればブロック出現と判定する。
- this.collidingMask = CollideBottom;
- this.collidingExcludeMask = CollideBody;
- this.lastCollidedTick = 0;
- this.collidedTickInterval = 10;
-}.extend(BlockClass, {
- tick : function()
- {
- this.checkTouchingDirection();
- //console.log(this.touchingDirection.toString(2));
- if((this.touchingDirection & this.collidingMask) == this.collidingMask){
- if((this.touchingDirection & this.collidingExcludeMask) == 0){
- if(this.lastCollidedTick < this.ownerStage.manager.tickCount - this.collidedTickInterval){
- //当たっていたら画像を表示させて、さらにこの関数をベースクラスのものに戻す。
- this.isPhantom = false;
- this.image = this.image0;
- this.tick = BlockClass.prototype.tick;
- this.debugDraw = BlockClass.prototype.debugDraw;
- } else{
- //違う方向からの衝突であればしばらく無視する
- this.lastCollidedTick = this.ownerStage.manager.tickCount;
- }
- } else{
- //違う方向からの衝突であればしばらく無視する
- this.lastCollidedTick = this.ownerStage.manager.tickCount;
- }
- }
- },
-
- debugDraw: function(x, y){
- //衝突マップに描画
- this.ownerStage.collisionMapContext.save();
- this.ownerStage.collisionMapContext.strokeStyle='rgba(0, 255, 0, 0.5)';
- strokeRect(this.ownerStage.collisionMapContext, x, y, this.size.x, this.size.y);
- this.ownerStage.collisionMapContext.restore();
- },
+var HiddenBlockClass = function(ownerStage, args)\r
+{\r
+ HiddenBlockClass.base.apply(this, arguments);\r
+ var img = document.createElement('img');\r
+ img.src = "images/" + args[0];\r
+ //一時的に保存\r
+ this.image0 = img;\r
+ //画像はなし\r
+ this.image = null;\r
+ \r
+ this.debugMode = true;\r
+ \r
+ this.isPhantom = true;\r
+ \r
+ //このフラグで立っているビットがすべて立っていればブロック出現と判定する。\r
+ this.collidingMask = CollideBottom;\r
+ this.collidingExcludeMask = CollideBody;\r
+ this.lastCollidedTick = 0;\r
+ this.collidedTickInterval = 10;\r
+}.extend(BlockClass, {\r
+ tick : function()\r
+ {\r
+ this.checkTouchingDirection();\r
+ //console.log(this.touchingDirection.toString(2));\r
+ if((this.touchingDirection & this.collidingMask) == this.collidingMask){\r
+ if((this.touchingDirection & this.collidingExcludeMask) == 0){\r
+ if(this.lastCollidedTick < this.ownerStage.manager.tickCount - this.collidedTickInterval){\r
+ //当たっていたら画像を表示させて、さらにこの関数をベースクラスのものに戻す。\r
+ this.isPhantom = false;\r
+ this.image = this.image0;\r
+ this.tick = BlockClass.prototype.tick;\r
+ this.debugDraw = BlockClass.prototype.debugDraw;\r
+ } else{\r
+ //違う方向からの衝突であればしばらく無視する\r
+ this.lastCollidedTick = this.ownerStage.manager.tickCount;\r
+ }\r
+ } else{\r
+ //違う方向からの衝突であればしばらく無視する\r
+ this.lastCollidedTick = this.ownerStage.manager.tickCount;\r
+ }\r
+ }\r
+ },\r
+ \r
+ debugDraw: function(x, y){\r
+ //衝突マップに描画\r
+ this.ownerStage.collisionMapContext.save();\r
+ this.ownerStage.collisionMapContext.strokeStyle='rgba(0, 255, 0, 0.5)';\r
+ strokeRect(this.ownerStage.collisionMapContext, x, y, this.size.x, this.size.y);\r
+ this.ownerStage.collisionMapContext.restore();\r
+ },\r
});
\ No newline at end of file