Changeset 286 for pycodeshooter


Ignore:
Timestamp:
04/18/16 03:00:39 (8 years ago)
Author:
atzm
Message:

add the `round'

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pycodeshooter/trunk/shooter/system.js

    r132 r286  
    2828    "score":            {}, 
    2929    "stage":            -1, 
     30    "round":            1, 
    3031    "backgroundObject": new Array(), 
    3132    "deathPieces":      new Array(), 
     
    282283} 
    283284 
     285function getRoundNumber() { 
     286    return System.round; 
     287} 
     288 
    284289function switchStage(base) { 
    285290    var scores   = Object.keys(System.score); 
     
    302307    stage        = Math.floor((score % (stages.length * base)) / base) + 1; 
    303308    switched     = System.stage != stage; 
     309    System.round = System.stage > stage ? System.round + 1 : System.round; 
    304310    System.stage = stage; 
    305311 
     
    357363    var brrgs   = new Array(); 
    358364 
    359     var bulletWay         = Math.ceil(enemyData.concentration / 10); 
     365    var bulletWay         = Math.ceil(enemyData.concentration / 10) * getRoundNumber(); 
    360366    var bulletInterval    = Math.round(50 * 1 / Math.log(enemyData.skillpoint + 0.1)); 
    361367    var bulletSize        = Math.round(Math.log(enemyData.luck + 1)); 
    362368    var bulletFrameWidth  = (bulletSize + 5) * 2; 
    363369    var bulletFrameHeight = (bulletSize + 5) * 4; 
    364     var bulletSpeed       = enemyData.strength / 15; 
     370    var bulletSpeed       = (enemyData.strength / 15) * getRoundNumber(); 
    365371 
    366372    bulletSpeed = Math.log(bulletSpeed < 1.5 ? 1.5 : bulletSpeed); 
     
    433439            ); 
    434440 
    435             var itemAttr; 
    436             var itemRand = Math.floor(Math.random() * 100); 
    437             if (itemRand < 40) { 
    438                 // nothing 
     441            var itemAttr = null; 
     442 
     443          PLAYERSLOOP: 
     444            for (var i = 0; i < System.players.length; i++) { 
     445                for (var k = 0; k < System.players[i].barrages.length; k++) { 
     446                    if (System.players[i].barrages[k].way <= 1) { 
     447                        itemAttr = {"color": "#FAA", "symbol": "P", "type": "shot", "quantity": 1}; 
     448                        break PLAYERSLOOP; 
     449                    } 
     450                } 
    439451            } 
    440             else if (itemRand < 70) { 
    441                 itemAttr = {"color": "#AAF", "symbol": "S", "type": "score", "quantity": enemy.maxLife * 200}; 
    442             } 
    443             else if (itemRand < 85) { 
    444                 itemAttr = {"color": "#FAA", "symbol": "P", "type": "shot", "quantity": 1}; 
    445             } 
    446             else if (itemRand < 95) { 
    447                 itemAttr = {"color": "#A5F", "symbol": "W", "type": "wide", "quantity": 1}; 
    448             } 
    449             else if (itemRand < 98) { 
    450                 itemAttr = {"color": "#FFA", "symbol": "B", "type": "bomb", "quantity": 1}; 
    451             } 
    452             else { 
    453                 itemAttr = {"color": "#AFA", "symbol": "L", "type": "life", "quantity": 1}; 
     452 
     453            if (!itemAttr) { 
     454                var itemRand = Math.floor(Math.random() * 100); 
     455                if (itemRand < 40) { 
     456                    // nothing 
     457                } 
     458                else if (itemRand < 70) { 
     459                    itemAttr = {"color": "#AAF", "symbol": "S", "type": "score", "quantity": enemy.maxLife * 200}; 
     460                } 
     461                else if (itemRand < 85) { 
     462                    itemAttr = {"color": "#FAA", "symbol": "P", "type": "shot", "quantity": 1}; 
     463                } 
     464                else if (itemRand < 95) { 
     465                    itemAttr = {"color": "#A5F", "symbol": "W", "type": "wide", "quantity": 1}; 
     466                } 
     467                else if (itemRand < 98) { 
     468                    itemAttr = {"color": "#FFA", "symbol": "B", "type": "bomb", "quantity": 1}; 
     469                } 
     470                else { 
     471                    itemAttr = {"color": "#AFA", "symbol": "L", "type": "life", "quantity": 1}; 
     472                } 
    454473            } 
    455474 
     
    495514        System.screen.ctx, 
    496515        "source-over", 
    497         "STAGE " + getStageNumber(), 
     516        "ROUND " + getRoundNumber() + " / STAGE " + getStageNumber(), 
    498517        System.screen.width - 10, 
    499518        15, 
Note: See TracChangeset for help on using the changeset viewer.