Skip to content

Commit

Permalink
Merge branch '4.13.3'
Browse files Browse the repository at this point in the history
refs #42
  • Loading branch information
niku committed Mar 16, 2015
2 parents e5d6168 + ac6dd03 commit 1b62294
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/main-scene.js
Expand Up @@ -118,9 +118,12 @@ var MainSceneLayer = cc.Layer.extend({
update: function(dt) {
if (this.state_ === MainSceneLayer.GameState["PLAYING"]) { // プレイ中のとき

// 毎フレーム実行される
var random = Math.floor(cc.random0To1() * (MainSceneLayer.FRUIT_SPAWN_RATE));
if(random === 0) {
var pastTime = MainSceneLayer.TIME_LIMIT_SECOND - this.second_; // 経過時間
var p = MainSceneLayer.FRUIT_SPAWN_INCREASE_BASE * (1 + Math.pow(MainSceneLayer.FRUIT_SPAWN_INCREASE_RATE, pastTime));
p = Math.min(p, MainSceneLayer.MAXIMUM_SPAWN_PROBABILITY);
var random = cc.random0To1();

if(random < p) {
this.addFruit();
}

Expand Down Expand Up @@ -404,6 +407,13 @@ MainSceneLayer.BOMB_PROBABILITY_RATE = 0.003;
// 普通のフルーツの数
MainSceneLayer.NORMAL_FRUIT_COUNT = 5;

// フルーツ出現頻度の初期値
MainSceneLayer.FRUIT_SPAWN_INCREASE_BASE = 0.02;
// フルーツ出現頻度の増加率
MainSceneLayer.FRUIT_SPAWN_INCREASE_RATE = 1.05;
// フルーツ出現頻度の最大値
MainSceneLayer.MAXIMUM_SPAWN_PROBABILITY = 0.5;

// http://www.cocos2d-x.org/reference/html5-js/V3.2/symbols/cc.Scene.html
var MainScene = cc.Scene.extend({
// http://www.cocos2d-x.org/reference/html5-js/V3.2/symbols/cc.Node.html#onEnter
Expand Down

0 comments on commit 1b62294

Please sign in to comment.