OSDN Git Service

ジャンプ計算式の修正
[h58pcdgame/GameScriptCoreLibrary.git] / www / corelib / classes / OperatedCharacterClass.js
index 4d4cadd..b8a12f7 100644 (file)
@@ -3,12 +3,21 @@ var OperatedCharacterClass = function(ownerStage, args){
        
        //\82±\82ê\82ç\82Ì\92l\82ð\81i\8ae\83L\83\83\83\89\83N\83^\81[\82ð\8e¦\82·\81j\8eq\83N\83\89\83X\82©\82ç\8fã\8f\91\82«\82·\82é\82±\82Æ\82Å\8cÂ\90«\82ð\90\82Ý\8fo\82¹\82é
        this.movingVelocity = 200;
-       this.jumpPower = 400;
+       this.jumpPower_tickCountBase = 10;
+       this.jumpPower_tickCountAtLeast = 5;
+       this.jumpPower_tickCount = this.jumpPower_tickCountBase;
+       this.jumpPower = 45;
+       this.jumpSound = createAudio("jump12.mp3");
+       this.collisionMarginTop = 2;
+       this.collisionMarginLeft = 10;
+       this.collisionMarginRight = 10;
+       this.collisionMarginBottom =2;
+       
 }.extend(CharacterClass, {
        className: "OperatedCharacterClass",
        //\82±\82±\82É\83L\83\83\83\89\82Ì\93®\82«\82É\91Î\82·\82é\90§\8cä\82ð\82¨\82±\82È\82¤\8f\88\97\9d\8cQ(\88Ú\93®\81A\8dU\8c\82\82È\82Ç)\82ð\8bL\8fq\81B
        //\83L\83\83\83\89\82²\82Æ\82É\90«\8e¿\82ð\95Ï\82¦\82½\82¢\82Ì\82Å\82 \82ê\82Î\82»\82ê\82ðthis.xxx\83C\83\93\83X\83^\83\93\83X\95Ï\90\94\82É\8bL\8fq\82µ\81A\8ag\92£\83N\83\89\83X\82Å\82»\82Ì\92l\82ð\8fã\8f\91\82«\82·\82é\82×\82«\82Å\82 \82é\81B
-       //\8f]\82Á\82Ä\82±\82Ì\8eq\83N\83\89\83X\82©\82çthis.movingSpeed\82È\82Ç\82ð\82¢\82\82é\82Ì\82Í\82Ó\82³\82í\82µ\82­\82È\82¢\82Æ\8dl\82¦\82é\81B\81A
+       //\8f]\82Á\82Ä\82±\82Ì\8eq\83N\83\89\83X\82©\82çthis.movingSpeed\82È\82Ç\82ð\82¢\82\82é\82Ì\82Í\82Ó\82³\82í\82µ\82­\82È\82¢\82Æ\8dl\82¦\82é\81B
        
        // \92Ê\8fí\8d\82É\90i\82Þ\82Æ\82«\82É\8cÄ\82Î\82ê\82é\81B\8d\83L\81[\82ð\89\9f\82µ\82Ä\82¢\82é\8aÔ\92\86tick\96\88\82É\8cÄ\82Î\82ê\82é
        goLeft : function(){
@@ -19,20 +28,35 @@ var OperatedCharacterClass = function(ownerStage, args){
        
        //\92Ê\8fí\89E\82É\90i\82Þ\82Æ\82«\82É\8cÄ\82Î\82ê\82é\81B
        goRight : function(){
-               this.imageState = 1;
+               this.imageState = 0;
                this.direction = 1;
                this.movingSpeed.x += (this.movingVelocity - this.movingSpeed.x) / 3;
        },
        
-       //\92Ê\8fí\83W\83\83\83\93\83v\82·\82é\82Æ\82«\82É\8cÄ\82Î\82ê\82é\81B
+       //\92Ê\8fí\83W\83\83\83\93\83v\82·\82é\82Æ\82«\82É\8cÄ\82Î\82ê\82é\81B\83W\83\83\83\93\83v\83L\81[\82ð\89\9f\82µ\82Ä\82¢\82é\8aÔ\82Í\82¸\82Á\82Æ\8cÄ\82Î\82ê\82é
        jump : function(){
                if((this.collideFlag & 4) != 0)
                {
-                       this.movingSpeed.y = -this.jumpPower
+                       this.jumpPower_tickCount = this.jumpPower_tickCountBase;
+               }
+               if(this.jumpPower_tickCount > 0){
+                       if(this.jumpPower_tickCount == this.jumpPower_tickCountBase){
+                               this.jumpSound.load();
+                               this.jumpSound.play();
+                       }
+                       this.jumpPower_tickCount--;
+                       var p = (this.jumpPower_tickCountBase / this.jumpPower_tickCountBase);
+                       this.movingSpeed.y += -this.jumpPower * p * p;
+               }
+       },
+       jumpEnd: function(){
+               if(this.jumpPower_tickCount < this.jumpPower_tickCountBase - this.jumpPower_tickCountAtLeast){
+                       this.jumpPower_tickCount = 0;
+               } else{
+                       this.jump();
                }
        },
        tick : function(){
-               
                OperatedCharacterClass.base.prototype.tick.apply(this); 
        },
        draw : function(x, y){