Changeset 109 for pycodeshooter/trunk/shooter
- Timestamp:
- 01/18/12 00:01:24 (13 years ago)
- Location:
- pycodeshooter/trunk/shooter
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pycodeshooter/trunk/shooter/system.js
r108 r109 22 22 }, 23 23 "message": null, 24 "enemyImages": new Array(), 24 25 "enemies": new Array(), 25 26 "players": new Array(), … … 194 195 } 195 196 197 function addEnemyImage(image) { 198 System.enemyImages.push(image); 199 } 200 196 201 function addEnemy(enemyData) { 197 202 var actList = EnemyActionLists[enemyData.mtime % EnemyActionLists.length]; … … 242 247 enemyData.name, 243 248 new actList(acts), 249 System.enemyImages[enemyData.hitpoint % System.enemyImages.length], 244 250 size, 245 251 size, … … 373 379 playerData.name, 374 380 new ActionList([new ManualAction(new ManualShot())]), 381 playerData.image, 375 382 playerData.size, 376 383 playerData.hitsize, -
pycodeshooter/trunk/shooter/trooper.js
r108 r109 71 71 }; 72 72 73 var Trooper = function(name, actList, size, hitSize, color, hitColor,73 var Trooper = function(name, actList, image, size, hitSize, color, hitColor, 74 74 x, y, w, h, life, speed, numBombs, bombColors, barrages) { 75 75 … … 78 78 this.name = name; 79 79 this.actList = actList; 80 this.image = image; 80 81 this.size = size; 81 82 this.hitSize = hitSize; … … 185 186 186 187 // draw trooper 187 ctx.beginPath(); 188 ctx.fillStyle = this.color; 189 ctx.arc(this.x, this.y, this.size, 0, Math.PI * 2.0, true); 190 ctx.fill(); 191 ctx.closePath(); 192 188 if (this.image) { 189 var w = this.image.width * (this.size / this.image.height); 190 var h = this.size; 191 var x = this.x - (w / 2); 192 var y = this.y - (h / 2); 193 ctx.drawImage(this.image, x, y, w, h); 194 } 195 else { 196 ctx.beginPath(); 197 ctx.fillStyle = this.color; 198 ctx.arc(this.x, this.y, this.size, 0, Math.PI * 2.0, true); 199 ctx.fill(); 200 ctx.closePath(); 201 } 202 203 // draw hit area 193 204 if (this.color != this.hitColor || this.size != this.hitSize) { 194 205 ctx.beginPath();
Note: See TracChangeset
for help on using the changeset viewer.