aboutsummaryrefslogtreecommitdiffstats
path: root/src/drawables
diff options
context:
space:
mode:
authorMaksymilian Jopek <maks@jopek.eu>2022-06-01 00:26:52 +0200
committerMaksymilian Jopek <maks@jopek.eu>2022-06-01 00:26:52 +0200
commit5413001f654d4ea27129cf2edfc15322f2ba27ec (patch)
treecd5c4bda29622ca5406a7f641143c7c5ead20a51 /src/drawables
parent0010f2de57cfa97106432ea1849c1bb75d3d99a1 (diff)
download1942-5413001f654d4ea27129cf2edfc15322f2ba27ec.tar.gz
1942-5413001f654d4ea27129cf2edfc15322f2ba27ec.tar.zst
1942-5413001f654d4ea27129cf2edfc15322f2ba27ec.zip
Spawning enemies, start Startscreen
Diffstat (limited to 'src/drawables')
-rw-r--r--src/drawables/Background.ts2
-rw-r--r--src/drawables/Startscreen.ts45
2 files changed, 46 insertions, 1 deletions
diff --git a/src/drawables/Background.ts b/src/drawables/Background.ts
index 1eef6c4..da091a1 100644
--- a/src/drawables/Background.ts
+++ b/src/drawables/Background.ts
@@ -11,7 +11,7 @@ export class Background extends Drawable {
}
// delta = -1751 + 24 + 2693;
delta = 0
- move(): boolean {
+ move() {
this.delta += 1;
return true;
}
diff --git a/src/drawables/Startscreen.ts b/src/drawables/Startscreen.ts
new file mode 100644
index 0000000..ea8dc40
--- /dev/null
+++ b/src/drawables/Startscreen.ts
@@ -0,0 +1,45 @@
+import { TOPBAR_HEIGHT } from "../consts"
+import Drawable from "../Drawable"
+import { IMGS } from "../Images"
+
+export default class Startscreen extends Drawable {
+ sprite = IMGS.startScreen0
+ si = 0
+ i = 0
+ j = 0
+ color = "white"
+ colors = ["white", "yellow", "blue", "purple", "red"]
+ ci = 0
+
+ constructor() {
+ super(0, TOPBAR_HEIGHT)
+ }
+
+ move() {
+ if(this.si === 0) {
+ if(this.i++ === 199) { this.sprite = IMGS.startScreen1; this.i = 0; this.si++ }
+ // if(this.i++ === 19) { this.sprite = IMGS.startScreen1; this.i = 0; this.si++ }
+ } else {
+ // if(this.i++ === 2) {
+ if(this.i++ === 9) {
+ this.ci++;
+ if(this.ci >= this.colors.length) {
+ if(this.j++ === 9) {
+ // if(this.j++ === 2) {
+ this.si++;
+ if(this.si > 4) this.si = 0
+ //@ts-expect-error
+ this.sprite = IMGS["startScreen" + this.si]
+ this.j = 0
+ }
+ this.ci = 0;
+ }
+ this.color = this.colors[this.ci]
+ this.i = 0
+ }
+ }
+ // console.log(this.sprite, this.color);
+
+ return true;
+ }
+}