Browse Source

I don't know, viagra?

master
mortie 6 years ago
parent
commit
354b2f0d42
4 changed files with 14 additions and 12 deletions
  1. BIN
      assets/common/images/powerup.png
  2. 8
    5
      js/assets.js
  3. 6
    7
      js/entities.js
  4. BIN
      xcf/powerup.xcf

BIN
assets/common/images/powerup.png View File


+ 8
- 5
js/assets.js View File

background: new ImageSource("background", null, ".jpg"), background: new ImageSource("background", null, ".jpg"),
wall: new ImageSource("wall"), wall: new ImageSource("wall"),
wall_overlap: new ImageSource("wall-overlap"), wall_overlap: new ImageSource("wall-overlap"),
powerup: new ImageSource("powerup"),
}, },


audio: { audio: {
var ext = ext || ".mp3"; var ext = ext || ".mp3";


this.elems = []; this.elems = [];
for (var i = 0; i < 10; ++i)
for (var i = 0; i < 10; ++i) {
this.elems[i] = new Audio(commonPath+"/"+src+ext); this.elems[i] = new Audio(commonPath+"/"+src+ext);

this.elems[i].addEventListener("ended", function() {
this.emit("ended");
}.bind(this));
}

this.ready = false; this.ready = false;
this.index = 0; this.index = 0;


this.emit("load"); this.emit("load");
}.bind(this)); }.bind(this));


this.elems[0].addEventListener("ended", function() {
this.emit("ended");
}.bind(this));

this.elems[0].onerror = function() { this.elems[0].onerror = function() {
console.error("Error with", src); console.error("Error with", src);
} }

+ 6
- 7
js/entities.js View File

function PowerUp(game, x, y, type) { function PowerUp(game, x, y, type) {
makeEnt(this, game, 100); makeEnt(this, game, 100);
this.layer = 1; this.layer = 1;
this.img = assets.imgs.powerup;


this.type = type; this.type = type;




this.pos.set({ x: x, y: y }); this.pos.set({ x: x, y: y });
} }
PowerUp.prototype.draw = function(ctx) {
ctx.fillStyle = "#33ee33";
ctx.strokeStyle = "#227722";
ctx.beginPath();
ctx.arc(15, 15, 15, 0, 2 * Math.PI);
ctx.stroke();
ctx.fill();
PowerUp.prototype.draw = function() {}
PowerUp.prototype.drawOverlay = function(ctx) {
ctx.scale(0.3, 0.3);
ctx.translate(-20, -5);
this.img.draw(ctx);
} }
PowerUp.prototype.update = function() { PowerUp.prototype.update = function() {
if (this.game.camera.x > this.pos.x + this.shape.width()) if (this.game.camera.x > this.pos.x + this.shape.width())

BIN
xcf/powerup.xcf View File


Loading…
Cancel
Save