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

@@ -8,6 +8,7 @@ var assets = {
background: new ImageSource("background", null, ".jpg"),
wall: new ImageSource("wall"),
wall_overlap: new ImageSource("wall-overlap"),
powerup: new ImageSource("powerup"),
},

audio: {
@@ -32,8 +33,14 @@ function AudioSource(src, ext) {
var ext = ext || ".mp3";

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].addEventListener("ended", function() {
this.emit("ended");
}.bind(this));
}

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

@@ -45,10 +52,6 @@ function AudioSource(src, ext) {
this.emit("load");
}.bind(this));

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

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

+ 6
- 7
js/entities.js View File

@@ -241,6 +241,7 @@ Obstacle.prototype.update = function() {
function PowerUp(game, x, y, type) {
makeEnt(this, game, 100);
this.layer = 1;
this.img = assets.imgs.powerup;

this.type = type;

@@ -248,13 +249,11 @@ function PowerUp(game, x, y, type) {

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() {
if (this.game.camera.x > this.pos.x + this.shape.width())

BIN
xcf/powerup.xcf View File


Loading…
Cancel
Save