OSDN Git Service

パン玉が三回バウンドで消滅するようになった。
author西田 耀 <hikarupsp@users.sourceforge.jp>
Tue, 27 Aug 2013 00:58:35 +0000 (09:58 +0900)
committer西田 耀 <hikarupsp@users.sourceforge.jp>
Tue, 27 Aug 2013 00:58:35 +0000 (09:58 +0900)
www/corelib/classes/FireObjectClass.js

index 577562d..4b76061 100644 (file)
@@ -1,14 +1,16 @@
 var FireObjectClass = function(stage, args){
        FireObjectClass.base.apply(this, arguments);
        
-       this.fireVelocity = new Point2D(800, 100);
+       this.fireVelocity = new Point2D(600, 100);
        this.isPhantom = true;
        this.size.x = 32;
        this.size.y = 32;
        this.movingSpeed.y = -this.fireVelocity.y;
        this.chasingRange = 0;
        this.isItemCollector = true;
-       
+       this.boundPower = 400;
+       this.boundCount = 0;
+       this.maxBoundCount = 3;
 }.extend(EnemyCharacterClass, {
        className: "FireObjectClass",
        fire: function(ownerObj){
@@ -52,6 +54,14 @@ var FireObjectClass = function(stage, args){
                        obj.damage(this.touchDamage);
                        this.ownerStage.removeStageObject(this);
                }
+               if((obj instanceof BlockClass || obj instanceof SlopeBlockClass) && this.lastCollidedTick + 10 < this.ownerStage.manager.tickCount){
+                       this.movingSpeed.y -= this.boundPower;
+                       this.boundCount++;
+                       if(this.maxBoundCount <= this.boundCount){
+                               this.ownerStage.removeStageObject(this);
+                       }
+               }
+               
                this.lastCollidedTick = this.ownerStage.manager.tickCount;
        },