bomb
This commit is contained in:
parent
4eead59af7
commit
3327eb381b
69
Script.js
69
Script.js
@ -63,14 +63,18 @@ var keys = {
|
|||||||
var playerShipImg = new Image();
|
var playerShipImg = new Image();
|
||||||
playerShipImg.src = "img/Player/pesawat22.png";
|
playerShipImg.src = "img/Player/pesawat22.png";
|
||||||
|
|
||||||
|
// --- GAMBAR PICKUP SKILLS ---
|
||||||
var missilePickupImg = new Image();
|
var missilePickupImg = new Image();
|
||||||
missilePickupImg.src = "img/Skills/missile.png";
|
missilePickupImg.src = "img/Skills/missile.png";
|
||||||
|
|
||||||
// *** GAMBAR BARU UNTUK PICKUP LASER ***
|
|
||||||
var laserPickupImg = new Image();
|
var laserPickupImg = new Image();
|
||||||
// Pastikan file gambar laser clay Anda disimpan di sini
|
|
||||||
laserPickupImg.src = "img/Skills/double-missile.png";
|
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();
|
var bg0 = new Image();
|
||||||
bg0.src = "img/bg_0.png";
|
bg0.src = "img/bg_0.png";
|
||||||
var bg1 = new Image();
|
var bg1 = new Image();
|
||||||
@ -1121,48 +1125,31 @@ class AbilityToken {
|
|||||||
draw() {
|
draw() {
|
||||||
ctx.save();
|
ctx.save();
|
||||||
|
|
||||||
// --- GAYA METAL SLUG (KOTAK PUTIH TEBAL) UNTUK MISSILE & DOUBLE LASER ---
|
// --- GAYA METAL SLUG (KOTAK PUTIH TEBAL) UNTUK SEMUA TIPE PICKUP ---
|
||||||
if (this.type === "missile" || this.type === "double") {
|
ctx.strokeStyle = "#ffffff";
|
||||||
ctx.strokeStyle = "#ffffff";
|
ctx.lineWidth = 3;
|
||||||
ctx.lineWidth = 3;
|
ctx.strokeRect(this.x, this.y, this.width, this.height);
|
||||||
ctx.strokeRect(this.x, this.y, this.width, this.height);
|
|
||||||
|
|
||||||
const padding = 4;
|
const padding = 4;
|
||||||
let imgToDraw = null;
|
let imgToDraw = null;
|
||||||
|
|
||||||
if (this.type === "missile") {
|
if (this.type === "missile") {
|
||||||
imgToDraw = missilePickupImg;
|
imgToDraw = missilePickupImg;
|
||||||
} else if (this.type === "double") {
|
} else if (this.type === "double") {
|
||||||
// GUNAKAN GAMBAR LASER PICKUP YANG BARU
|
imgToDraw = laserPickupImg;
|
||||||
imgToDraw = laserPickupImg;
|
} else if (this.type === "bomb") {
|
||||||
}
|
// GUNAKAN GAMBAR BOM PICKUP YANG BARU
|
||||||
|
imgToDraw = bombPickupImg;
|
||||||
|
}
|
||||||
|
|
||||||
if (imgToDraw) {
|
if (imgToDraw) {
|
||||||
ctx.drawImage(
|
ctx.drawImage(
|
||||||
imgToDraw,
|
imgToDraw,
|
||||||
this.x + padding,
|
this.x + padding,
|
||||||
this.y + padding,
|
this.y + padding,
|
||||||
this.width - padding * 2,
|
this.width - padding * 2,
|
||||||
this.height - 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();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.restore();
|
ctx.restore();
|
||||||
|
|||||||
BIN
img/Skills/bomb.png
Normal file
BIN
img/Skills/bomb.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 277 KiB |
Loading…
x
Reference in New Issue
Block a user