aboutsummaryrefslogtreecommitdiffstats
path: root/src/Images.ts
diff options
context:
space:
mode:
authorMaksymilian Jopek <maks@jopek.eu>2022-06-02 08:54:02 +0200
committerMaksymilian Jopek <maks@jopek.eu>2022-06-02 08:54:02 +0200
commit6c37585ef4ef2535aff8c45c64850be0a6c26eab (patch)
treec53e07505182735fbd23687a0c731d4bb2f10e14 /src/Images.ts
parent7a494b148dd03d6346a63641fc479015e7450a26 (diff)
download1942-6c37585ef4ef2535aff8c45c64850be0a6c26eab.tar.gz
1942-6c37585ef4ef2535aff8c45c64850be0a6c26eab.tar.zst
1942-6c37585ef4ef2535aff8c45c64850be0a6c26eab.zip
Death animations
Diffstat (limited to 'src/Images.ts')
-rw-r--r--src/Images.ts112
1 files changed, 101 insertions, 11 deletions
diff --git a/src/Images.ts b/src/Images.ts
index eeda006..99e9b02 100644
--- a/src/Images.ts
+++ b/src/Images.ts
@@ -1,9 +1,8 @@
-// const URLS = [
-// "/src/imgs/bg2.png",
-// "/src/imgs/topbar.png",
-// ];
+import Anime from "./Animation";
import { allChars, alphabet } from "./consts";
+import Enemy from "./enemies/Enemy";
import { toKebabCase } from "./helpers";
+import Player from "./Player";
export const IMGS = {
bg: {} as HTMLImageElement,
@@ -61,13 +60,54 @@ export const IMGS = {
whiteTurnRight: {} as HTMLImageElement,
whiteStrangeLeft: {} as HTMLImageElement,
whiteStrangeRight: {} as HTMLImageElement,
+ playerDeath1: {} as HTMLImageElement,
+ playerDeath2: {} as HTMLImageElement,
+ playerDeath3: {} as HTMLImageElement,
+ playerDeath4: {} as HTMLImageElement,
+ playerDeath5: {} as HTMLImageElement,
+ playerDeath6: {} as HTMLImageElement,
+ playerDeath7: {} as HTMLImageElement,
+ playerDeath8: {} as HTMLImageElement,
+ playerDeath9: {} as HTMLImageElement,
+ playerDeath10: {} as HTMLImageElement,
+ playerDeath11: {} as HTMLImageElement,
+ playerDeath12: {} as HTMLImageElement,
+ playerDeath13: {} as HTMLImageElement,
+ playerDeath14: {} as HTMLImageElement,
+ playerDeath15: {} as HTMLImageElement,
+ playerDeath16: {} as HTMLImageElement,
+ playerDeath17: {} as HTMLImageElement,
+ playerDeath18: {} as HTMLImageElement,
+ playerDeath19: {} as HTMLImageElement,
+ playerDeath20: {} as HTMLImageElement,
+ playerDeath21: {} as HTMLImageElement,
+ smallDeath1: {} as HTMLImageElement,
+ smallDeath2: {} as HTMLImageElement,
+ smallDeath3: {} as HTMLImageElement,
+ smallDeath4: {} as HTMLImageElement,
+ smallDeath5: {} as HTMLImageElement,
+ smallDeath6: {} as HTMLImageElement,
+ bigDeath1: {} as HTMLImageElement,
+ bigDeath2: {} as HTMLImageElement,
+ bigDeath3: {} as HTMLImageElement,
+ bigDeath4: {} as HTMLImageElement,
+ bigDeath5: {} as HTMLImageElement,
+ bigDeath6: {} as HTMLImageElement,
+ bigDeath7: {} as HTMLImageElement,
+ bigDeath8: {} as HTMLImageElement,
+ bigDeath9: {} as HTMLImageElement,
+ bigDeath10: {} as HTMLImageElement,
+ bigDeath11: {} as HTMLImageElement,
+ playerBullet2: {} as HTMLImageElement,
+ playerBullet3: {} as HTMLImageElement,
+ enemyBullet: {} as HTMLImageElement,
planeIcon: {} as HTMLImageElement,
rollIcon: {} as HTMLImageElement,
- startScreen0: {} as HTMLImageElement,
- startScreen1: {} as HTMLImageElement,
- startScreen2: {} as HTMLImageElement,
- startScreen3: {} as HTMLImageElement,
- startScreen4: {} as HTMLImageElement,
+ // startScreen0: {} as HTMLImageElement,
+ // startScreen1: {} as HTMLImageElement,
+ // startScreen2: {} as HTMLImageElement,
+ // startScreen3: {} as HTMLImageElement,
+ // startScreen4: {} as HTMLImageElement,
font: {
white: {} as any,
yellow: {} as any,
@@ -89,8 +129,8 @@ export default async function loadAllImages() {
if (["empty", "font"].includes(key)) continue;
IMGS[key as keyof typeof IMGS] = await asyncImageLoader("/src/imgs/" + toKebabCase(key) + ".png") as any
}
- for (const color of ['yellow', 'white', 'blue', 'red', 'green', 'purple']) {
- // for (const color of ['white']) {
+ // for (const color of ['yellow', 'white', 'blue', 'red', 'green', 'purple']) {
+ for (const color of ['white']) {
for (const char of allChars) {
(((IMGS.font as any)[color] as any)[char]) = await asyncImageLoader("/src/imgs/font/" + color + "/" + encodeURIComponent(char) + ".png") as any
}
@@ -116,3 +156,53 @@ async function asyncImageLoader(url: string): Promise<HTMLImageElement> {
})
}
+export function getSmallDeathAnim(t: Enemy) {
+ return new Anime(t, [
+ IMGS.smallDeath1,
+ IMGS.smallDeath2,
+ IMGS.smallDeath3,
+ IMGS.smallDeath4,
+ IMGS.smallDeath5,
+ IMGS.smallDeath6,
+ ])
+}
+export function getBigDeathAnim(t: Enemy) {
+ return new Anime(t, [
+ IMGS.bigDeath1,
+ IMGS.bigDeath2,
+ IMGS.bigDeath3,
+ IMGS.bigDeath4,
+ IMGS.bigDeath5,
+ IMGS.bigDeath6,
+ IMGS.bigDeath7,
+ IMGS.bigDeath8,
+ IMGS.bigDeath9,
+ IMGS.bigDeath10,
+ IMGS.bigDeath11,
+ ])
+}
+export function getPlayerDeathAnim(t: Player) {
+ return new Anime(t, [
+ IMGS.playerDeath1,
+ IMGS.playerDeath2,
+ IMGS.playerDeath3,
+ IMGS.playerDeath4,
+ IMGS.playerDeath5,
+ IMGS.playerDeath6,
+ IMGS.playerDeath7,
+ IMGS.playerDeath8,
+ IMGS.playerDeath9,
+ IMGS.playerDeath10,
+ IMGS.playerDeath11,
+ IMGS.playerDeath12,
+ IMGS.playerDeath13,
+ IMGS.playerDeath14,
+ IMGS.playerDeath15,
+ IMGS.playerDeath16,
+ IMGS.playerDeath17,
+ IMGS.playerDeath18,
+ IMGS.playerDeath19,
+ IMGS.playerDeath20,
+ IMGS.playerDeath21,
+ ])
+}