difficulty
This commit is contained in:
parent
ad49a7d15d
commit
99c401c0c0
18
Script.js
18
Script.js
@ -340,7 +340,10 @@ function drawGame() {
|
|||||||
let en = enemyShipArray[j];
|
let en = enemyShipArray[j];
|
||||||
|
|
||||||
if (Tabrakan(m.getHitbox(), en.getHitbox())) {
|
if (Tabrakan(m.getHitbox(), en.getHitbox())) {
|
||||||
en.health -= 100;
|
// --- BALANCING DAMAGE PLAYER ---
|
||||||
|
let playerDamage = 100 + game.level * 5;
|
||||||
|
en.health -= playerDamage;
|
||||||
|
|
||||||
createParticles(
|
createParticles(
|
||||||
en.x + en.width / 2,
|
en.x + en.width / 2,
|
||||||
en.y + en.height / 2,
|
en.y + en.height / 2,
|
||||||
@ -477,7 +480,6 @@ class PlayerObject {
|
|||||||
this.spriteWidth = 0;
|
this.spriteWidth = 0;
|
||||||
this.sourceHeight = 0;
|
this.sourceHeight = 0;
|
||||||
// --- SIZE PLAYER: Middle Ground ---
|
// --- SIZE PLAYER: Middle Ground ---
|
||||||
// Awal: 1.3 | Kecil: 0.85 | Sekarang: 1.0
|
|
||||||
this.scale = 1.0;
|
this.scale = 1.0;
|
||||||
|
|
||||||
this.image.onload = () => {
|
this.image.onload = () => {
|
||||||
@ -671,7 +673,6 @@ class LaserBullet {
|
|||||||
constructor(x, y) {
|
constructor(x, y) {
|
||||||
this.x = x;
|
this.x = x;
|
||||||
this.y = y;
|
this.y = y;
|
||||||
// Ukuran Bullet sedikit dibesarkan
|
|
||||||
this.width = 13;
|
this.width = 13;
|
||||||
this.height = 4;
|
this.height = 4;
|
||||||
this.speed = 16;
|
this.speed = 16;
|
||||||
@ -708,7 +709,6 @@ class EnemyObj {
|
|||||||
this.x = x;
|
this.x = x;
|
||||||
this.y = y;
|
this.y = y;
|
||||||
// --- SIZE MUSUH: Middle Ground ---
|
// --- SIZE MUSUH: Middle Ground ---
|
||||||
// Awal: 170 | Kecil: 120 | Sekarang: 145
|
|
||||||
this.width = 145;
|
this.width = 145;
|
||||||
this.height = 90;
|
this.height = 90;
|
||||||
this.image = img;
|
this.image = img;
|
||||||
@ -746,7 +746,6 @@ class EnemyBullet {
|
|||||||
constructor(x, y, targetX, targetY) {
|
constructor(x, y, targetX, targetY) {
|
||||||
this.x = x;
|
this.x = x;
|
||||||
this.y = y;
|
this.y = y;
|
||||||
// Ukuran Bullet sedikit dibesarkan
|
|
||||||
this.width = 10;
|
this.width = 10;
|
||||||
this.height = 4;
|
this.height = 4;
|
||||||
|
|
||||||
@ -894,7 +893,12 @@ function spawnEnemyFromWave(wave) {
|
|||||||
y = Math.max(60, Math.min(canvasHeight - 100, y));
|
y = Math.max(60, Math.min(canvasHeight - 100, y));
|
||||||
|
|
||||||
const randomShip = Math.floor(Math.random() * enemyImgArray.length);
|
const randomShip = Math.floor(Math.random() * enemyImgArray.length);
|
||||||
const speed = 4 + Math.random() * 3 + game.level * 0.25;
|
// --- KECEPATAN MUSUH DIPERLAMBAT ---
|
||||||
|
// Lama: 4 + Math.random()*3 + game.level*0.25 (Cepat)
|
||||||
|
// Baru: 3.5 + Math.random()*2 + game.level*0.1 (Lambat & Scaling Halus)
|
||||||
|
// Max Speed: 8 (Agar tidak teleportasi)
|
||||||
|
let rawSpeed = 3.5 + Math.random() * 2 + game.level * 0.2;
|
||||||
|
const speed = Math.min(rawSpeed, 8);
|
||||||
|
|
||||||
let enemy = new EnemyObj(
|
let enemy = new EnemyObj(
|
||||||
canvasWidth + 50,
|
canvasWidth + 50,
|
||||||
@ -904,7 +908,7 @@ function spawnEnemyFromWave(wave) {
|
|||||||
wave.pattern === "sine" ? "sine" : "straight"
|
wave.pattern === "sine" ? "sine" : "straight"
|
||||||
);
|
);
|
||||||
|
|
||||||
// BALANCING HEALTH (Low)
|
// BALANCING HEALTH
|
||||||
enemy.health = 60 + game.level * 10;
|
enemy.health = 60 + game.level * 10;
|
||||||
|
|
||||||
enemyShipArray.push(enemy);
|
enemyShipArray.push(enemy);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user