game done
This commit is contained in:
parent
c214c06827
commit
2e203fe8dd
16
game.js
16
game.js
@ -1,16 +1,14 @@
|
|||||||
import * as lib from "./lib.js"
|
import * as lib from "./lib.js"
|
||||||
|
|
||||||
const { loadImage } = lib.texture;
|
const playerSprite = await lib.texture.loadImage("assets/player.png", 64, 64);
|
||||||
|
const bulletSprite = await lib.texture.loadImage("assets/bullet1.png", 24, 24);
|
||||||
const playerSprite = await loadImage("assets/player.png", 64, 64);
|
const enemySprite = await lib.texture.loadImage("assets/enemy1.png", 48, 48);
|
||||||
const bulletSprite = await loadImage("assets/bullet1.png", 24, 24);
|
|
||||||
const enemySprite = await loadImage("assets/enemy1.png", 48, 48);
|
|
||||||
|
|
||||||
const explosionSprites = [
|
const explosionSprites = [
|
||||||
await loadImage(`assets/explosion1.png`, 64, 64),
|
await lib.texture.loadImage(`assets/explosion1.png`, 64, 64),
|
||||||
await loadImage(`assets/explosion2.png`, 64, 64),
|
await lib.texture.loadImage(`assets/explosion2.png`, 64, 64),
|
||||||
await loadImage(`assets/explosion3.png`, 64, 64),
|
await lib.texture.loadImage(`assets/explosion3.png`, 64, 64),
|
||||||
await loadImage(`assets/explosion4.png`, 64, 64),
|
await lib.texture.loadImage(`assets/explosion4.png`, 64, 64),
|
||||||
];
|
];
|
||||||
|
|
||||||
const enemyBullet = bulletSprite.copy();
|
const enemyBullet = bulletSprite.copy();
|
||||||
|
@ -98,8 +98,8 @@ export class Texture {
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {string} path
|
* @param {string} path
|
||||||
* @param {number | undefined} width
|
* @param {number} [width]
|
||||||
* @param {number | undefined} height
|
* @param {number} [height]
|
||||||
* @returns {Promise<Texture>}
|
* @returns {Promise<Texture>}
|
||||||
*/
|
*/
|
||||||
export function loadImage(path, width, height) {
|
export function loadImage(path, width, height) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user