Skip to content

Commit

Permalink
Init all
Browse files Browse the repository at this point in the history
  • Loading branch information
deltea committed Apr 1, 2021
1 parent 77bc400 commit 5221bce
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 5 deletions.
29 changes: 25 additions & 4 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,9 +322,12 @@ function create() {
} else if (box.entity === "carrotPowerup") {
// Create carrotPowerup
game.carrotPowerup.create(box.x, box.y - 30, "carrotPowerup").setCollideWorldBounds(true).setScale(0.5).setVelocityY(-500);
} else {
} else if (box.entity === "mushroomPowerup") {
// Create mushroomPowerup
game.mushroomPowerup.create(box.x, box.y - 30, "mushroomPowerup").setCollideWorldBounds(true).setScale(0.8).setVelocityY(-500);
} else {
// Create swordPowerup
game.swordPowerup.create(box.x, box.y - 30, "sword").setCollideWorldBounds(true).setScale(0.8).setVelocityY(-500);
}
}
}
Expand Down Expand Up @@ -710,13 +713,31 @@ function create() {
// SFX
sfx.powerup.play();

// Add to coins
// Enable
game.carrot = true;

// Destroy
powerup.destroy();
});

// SwordPowerup
game.swordPowerup = this.physics.add.group();

// Collider Box, SwordPowerup
this.physics.add.collider(game.boxes, game.swordPowerup);

// Collider Player, SwordPowerup
this.physics.add.overlap(game.player, game.swordPowerup, function(player, powerup) {
// SFX
sfx.powerup.play();

// Enable
game.sword = true;

// Destroy
powerup.destroy();
});

// MushroomPowerup
game.mushroomPowerup = this.physics.add.group();

Expand All @@ -728,7 +749,7 @@ function create() {
// SFX
sfx.powerup.play();

// Add to coins
// Enable
game.bounceMagic = true;

// Destroy
Expand Down Expand Up @@ -1204,7 +1225,7 @@ function update() {
// Check
if (sprite.timer < 0) {
// Reset timer
sprite.timer = 100;
sprite.timer = 200;

// Attributes
laserBlast = game.laserBlasts.create(sprite.x, sprite.y, "laser");
Expand Down
8 changes: 7 additions & 1 deletion world.js
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,9 @@ const world = {

// On box
[1640, 421],

// Underground
[5926, 1110],
],
boxes: [
// Alternate
Expand Down Expand Up @@ -434,6 +437,7 @@ const world = {

// Underground
[2880, 922, "coin"],
[5771, 922, "swordPowerup"],
],
spiders: [
// Floating platform
Expand Down Expand Up @@ -510,6 +514,8 @@ const world = {
[5080, 1110, false],
[5320, 1110, false],
[5440, 1110, false],

[5706, 1110, false],
],
snails: [
[3000, 1122],
Expand All @@ -520,7 +526,7 @@ const world = {
[4330, 953, "R"],
[4380, 995, "R"],
[4426, 1040, "R"],
[4526, 4426, "L"],
[5526, 1115, "L"],
],
flags: [
// Box
Expand Down

0 comments on commit 5221bce

Please sign in to comment.