```commit-message
Enemy bullet firing logic update with randomization and missile trajectory adjustments - Added randomization to enemy bullet firing (50% chance of shooting straight down) - Adjusted enemy missile trajectories by reversing vertical velocity and updating angles - This change introduces more varied enemy behavior while maintaining game balance ```
This commit is contained in:
parent
c93e599556
commit
68a49a69bc
|
|
@ -513,10 +513,13 @@ export class GameScene extends Phaser.Scene {
|
|||
bullet.setVelocityY(Math.sin(angle) * speed);
|
||||
bullet.setScale(1.5);
|
||||
} else if (texture === 1) {
|
||||
// Regular straight-down shooting
|
||||
const bullet = this.enemyBullets.create(enemy.x, enemy.y, 'enemyBullet');
|
||||
bullet.setVelocityY(300); // Move straight down at 200px/s
|
||||
bullet.setScale(1.5);
|
||||
const vari = Phaser.Math.Between(1,2);
|
||||
if (vari === 2) {
|
||||
// Regular straight-down shooting
|
||||
const bullet = this.enemyBullets.create(enemy.x, enemy.y, 'enemyBullet');
|
||||
bullet.setVelocityY(300); // Move straight down at 200px/s
|
||||
bullet.setScale(1.5);
|
||||
}
|
||||
}
|
||||
|
||||
// Sound effect for enemy shooting
|
||||
|
|
@ -533,8 +536,8 @@ export class GameScene extends Phaser.Scene {
|
|||
const missle2 = this.enemyMissles.create(enemy.x, enemy.y, 'enemy-sprite', 30);
|
||||
|
||||
// Initial velocity
|
||||
missle1.setVelocityX(-100).setVelocityY(200).setAngle(45).setScale(.5);
|
||||
missle2.setVelocityX(100).setVelocityY(200).setAngle(-45).setScale(.5);
|
||||
missle1.setVelocityX(-100).setVelocityY(-200).setAngle(135).setScale(.5);
|
||||
missle2.setVelocityX(100).setVelocityY(-200).setAngle(-135).setScale(.5);
|
||||
|
||||
// After 500ms, change direction towards player and increase speed
|
||||
this.time.delayedCall(500, () => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue