OSDN Git Service

ジャンプ計算式の修正
author西田 耀 <hikarupsp@users.sourceforge.jp>
Wed, 21 Aug 2013 06:00:54 +0000 (15:00 +0900)
committer西田 耀 <hikarupsp@users.sourceforge.jp>
Wed, 21 Aug 2013 06:00:54 +0000 (15:00 +0900)
www/corelib/classes/GameStageClass.js
www/corelib/classes/OperatedCharacterClass.js

index c8d1a14..c9fc46d 100644 (file)
@@ -24,8 +24,6 @@ function GameStage(){
        this.background = null;
        //\83\86\81[\83U\81[\82ª\91\80\8dì\82µ\82Ä\82¢\82é\83L\83\83\83\89\83N\83^\81[\83I\83u\83W\83F\83N\83g
        this.userControlledCharacter = null;
-       
-       this.jumping = false;
 }
 GameStage.prototype = {
        //\88È\89º\82Ì\8aÖ\90\94\82ð\83I\81[\83o\81[\83\89\83C\83h\82µ\82Ä\83X\83e\81[\83W\82ð\8dì\90¬\82·\82é\81B
@@ -64,12 +62,8 @@ GameStage.prototype = {
                        {
                                //\83W\83\83\83\93\83v
                                this.userControlledCharacter.jump();
-                               this.jumping = true;
                        } else{
-                               if(this.jumping){
-                                       this.userControlledCharacter.jumpEnd();
-                                       this.jumping = false;
-                               }
+                               this.userControlledCharacter.jumpEnd();
                        }
                        if(!(this.manager.UIManager.keyState.goLeft && this.manager.UIManager.keyState.goRight))
                        {
index 4ad219a..b8a12f7 100644 (file)
@@ -4,6 +4,7 @@ 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_tickCountBase = 10;
+       this.jumpPower_tickCountAtLeast = 5;
        this.jumpPower_tickCount = this.jumpPower_tickCountBase;
        this.jumpPower = 45;
        this.jumpSound = createAudio("jump12.mp3");
@@ -46,11 +47,14 @@ var OperatedCharacterClass = function(ownerStage, args){
                        this.jumpPower_tickCount--;
                        var p = (this.jumpPower_tickCountBase / this.jumpPower_tickCountBase);
                        this.movingSpeed.y += -this.jumpPower * p * p;
-                       console.log(this.movingSpeed.y);
                }
        },
        jumpEnd: function(){
-               this.jumpPower_tickCount = 0;
+               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);