This commit is contained in:
Bluwww 2025-12-15 23:11:15 +07:00
parent 4eead59af7
commit 3327eb381b
2 changed files with 28 additions and 41 deletions

View File

@ -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();

BIN
img/Skills/bomb.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 277 KiB