@@ -322,9 +322,12 @@ function create() {
322
322
} else if ( box . entity === "carrotPowerup" ) {
323
323
// Create carrotPowerup
324
324
game . carrotPowerup . create ( box . x , box . y - 30 , "carrotPowerup" ) . setCollideWorldBounds ( true ) . setScale ( 0.5 ) . setVelocityY ( - 500 ) ;
325
- } else {
325
+ } else if ( box . entity === "mushroomPowerup" ) {
326
326
// Create mushroomPowerup
327
327
game . mushroomPowerup . create ( box . x , box . y - 30 , "mushroomPowerup" ) . setCollideWorldBounds ( true ) . setScale ( 0.8 ) . setVelocityY ( - 500 ) ;
328
+ } else {
329
+ // Create swordPowerup
330
+ game . swordPowerup . create ( box . x , box . y - 30 , "sword" ) . setCollideWorldBounds ( true ) . setScale ( 0.8 ) . setVelocityY ( - 500 ) ;
328
331
}
329
332
}
330
333
}
@@ -710,13 +713,31 @@ function create() {
710
713
// SFX
711
714
sfx . powerup . play ( ) ;
712
715
713
- // Add to coins
716
+ // Enable
714
717
game . carrot = true ;
715
718
716
719
// Destroy
717
720
powerup . destroy ( ) ;
718
721
} ) ;
719
722
723
+ // SwordPowerup
724
+ game . swordPowerup = this . physics . add . group ( ) ;
725
+
726
+ // Collider Box, SwordPowerup
727
+ this . physics . add . collider ( game . boxes , game . swordPowerup ) ;
728
+
729
+ // Collider Player, SwordPowerup
730
+ this . physics . add . overlap ( game . player , game . swordPowerup , function ( player , powerup ) {
731
+ // SFX
732
+ sfx . powerup . play ( ) ;
733
+
734
+ // Enable
735
+ game . sword = true ;
736
+
737
+ // Destroy
738
+ powerup . destroy ( ) ;
739
+ } ) ;
740
+
720
741
// MushroomPowerup
721
742
game . mushroomPowerup = this . physics . add . group ( ) ;
722
743
@@ -728,7 +749,7 @@ function create() {
728
749
// SFX
729
750
sfx . powerup . play ( ) ;
730
751
731
- // Add to coins
752
+ // Enable
732
753
game . bounceMagic = true ;
733
754
734
755
// Destroy
@@ -1204,7 +1225,7 @@ function update() {
1204
1225
// Check
1205
1226
if ( sprite . timer < 0 ) {
1206
1227
// Reset timer
1207
- sprite . timer = 100 ;
1228
+ sprite . timer = 200 ;
1208
1229
1209
1230
// Attributes
1210
1231
laserBlast = game . laserBlasts . create ( sprite . x , sprite . y , "laser" ) ;
0 commit comments