Changeset 119 for pycodeshooter/trunk/shooter/trooper.js
- Timestamp:
- 01/22/12 03:41:27 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pycodeshooter/trunk/shooter/trooper.js
r114 r119 75 75 76 76 this.bullets = new Array(); 77 this.callbacks = {}; 77 78 this.bomb = null; 78 79 this.name = name; … … 172 173 173 174 // update my life 174 if (hit && this.life > 0) 175 if (hit && this.life > 0) { 175 176 this.life--; 177 178 if (this.callbacks["damaged"]) 179 this.callbacks["damaged"](this); 180 } 176 181 } 177 182 }; … … 215 220 this.bullets.push( 216 221 new bulletType(size, color, frame, this.w, this.h, this.x + x, this.y + y, dir, speed)); 222 223 if (this.callbacks["addBullet"]) 224 this.callbacks["addBullet"](this); 217 225 }; 218 226 … … 242 250 this.size * 2, 10, this.bombColors); 243 251 this.numBombs--; 244 } 252 253 if (this.callbacks["addBomb"]) 254 this.callbacks["addBomb"](this); 255 } 256 }; 257 258 this.registerCallback = function(name, callback) { 259 this.callbacks[name] = callback; 245 260 }; 246 261 }
Note: See TracChangeset
for help on using the changeset viewer.