Ignore:
Timestamp:
01/22/11 21:00:02 (13 years ago)
Author:
atzm
Message:

modified atari hantei

File:
1 edited

Legend:

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

    r96 r97  
    6767}; 
    6868 
    69 var Trooper = function(name, actList, size, color, x, y, w, h, 
    70                        life, speed, numBombs, barrages) { 
     69var Trooper = function(name, actList, size, hitSize, color, hitColor, 
     70                       x, y, w, h, life, speed, numBombs, barrages) { 
    7171 
    7272    this.bullets  = new Array(); 
     
    7575    this.actList  = actList; 
    7676    this.size     = size; 
     77    this.hitSize  = hitSize; 
    7778    this.color    = color; 
     79    this.hitColor = hitColor; 
    7880    this.x        = x; 
    7981    this.y        = y; 
     
    141143        delIdx = new Array(); 
    142144        for (var i = 0; i < enemy.bullets.length; i++) { 
    143             if (touch(this.x, this.y, this.size, 
     145            if (touch(this.x, this.y, this.hitSize, 
    144146                      enemy.bullets[i].x, enemy.bullets[i].y, enemy.bullets[i].size)) 
    145147                delIdx.push(i); 
     
    164166        ctx.closePath(); 
    165167 
     168        if (this.color != this.hitColor || this.size != this.hitSize) { 
     169            ctx.beginPath(); 
     170            ctx.fillStyle = this.hitColor; 
     171            ctx.arc(this.x, this.y, this.hitSize, 0, Math.PI * 2.0, true); 
     172            ctx.fill(); 
     173            ctx.closePath(); 
     174        } 
     175 
    166176        // draw bullets 
    167177        for (var i = 0; i < this.bullets.length; i++) 
Note: See TracChangeset for help on using the changeset viewer.