diff --git a/Script.js b/Script.js index 8e6cf5c..16b347d 100644 --- a/Script.js +++ b/Script.js @@ -63,14 +63,18 @@ var keys = { var playerShipImg = new Image(); playerShipImg.src = "img/Player/pesawat22.png"; +// --- GAMBAR PICKUP SKILLS --- var missilePickupImg = new Image(); missilePickupImg.src = "img/Skills/missile.png"; -// *** GAMBAR BARU UNTUK PICKUP LASER *** var laserPickupImg = new Image(); -// Pastikan file gambar laser clay Anda disimpan di sini laserPickupImg.src = "img/Skills/double-missile.png"; +// *** GAMBAR BARU UNTUK PICKUP BOMB *** +var bombPickupImg = new Image(); +// Pastikan file gambar bom clay Anda disimpan di sini +bombPickupImg.src = "img/Skills/bomb.png"; + var bg0 = new Image(); bg0.src = "img/bg_0.png"; var bg1 = new Image(); @@ -1121,48 +1125,31 @@ class AbilityToken { draw() { ctx.save(); - // --- GAYA METAL SLUG (KOTAK PUTIH TEBAL) UNTUK MISSILE & DOUBLE LASER --- - if (this.type === "missile" || this.type === "double") { - ctx.strokeStyle = "#ffffff"; - ctx.lineWidth = 3; - ctx.strokeRect(this.x, this.y, this.width, this.height); + // --- GAYA METAL SLUG (KOTAK PUTIH TEBAL) UNTUK SEMUA TIPE PICKUP --- + ctx.strokeStyle = "#ffffff"; + ctx.lineWidth = 3; + ctx.strokeRect(this.x, this.y, this.width, this.height); - const padding = 4; - let imgToDraw = null; + const padding = 4; + let imgToDraw = null; - if (this.type === "missile") { - imgToDraw = missilePickupImg; - } else if (this.type === "double") { - // GUNAKAN GAMBAR LASER PICKUP YANG BARU - imgToDraw = laserPickupImg; - } + if (this.type === "missile") { + imgToDraw = missilePickupImg; + } else if (this.type === "double") { + imgToDraw = laserPickupImg; + } else if (this.type === "bomb") { + // GUNAKAN GAMBAR BOM PICKUP YANG BARU + imgToDraw = bombPickupImg; + } - if (imgToDraw) { - ctx.drawImage( - imgToDraw, - this.x + padding, - this.y + padding, - this.width - padding * 2, - this.height - padding * 2 - ); - } - } else { - // --- GAYA LAMA (ORB LINGKARAN) HANYA UNTUK BOMB --- - ctx.beginPath(); - const cx = this.x + this.width / 2; - const cy = this.y + this.height / 2; - ctx.arc(cx, cy, 16, 0, Math.PI * 2); // Radius disesuaikan dengan ukuran baru - - const g = ctx.createRadialGradient(cx, cy, 0, cx, cy, 16); - g.addColorStop(0, "#ffffff"); - - if (this.type === "bomb") { - g.addColorStop(0.5, "#ffff00"); // Kuning - g.addColorStop(1, "#ff9900"); - } - - ctx.fillStyle = g; - ctx.fill(); + if (imgToDraw) { + ctx.drawImage( + imgToDraw, + this.x + padding, + this.y + padding, + this.width - padding * 2, + this.height - padding * 2 + ); } ctx.restore(); diff --git a/img/Skills/bomb.png b/img/Skills/bomb.png new file mode 100644 index 0000000..8d3bfa2 Binary files /dev/null and b/img/Skills/bomb.png differ