From 5413001f654d4ea27129cf2edfc15322f2ba27ec Mon Sep 17 00:00:00 2001 From: Maksymilian Jopek Date: Wed, 1 Jun 2022 00:26:52 +0200 Subject: Spawning enemies, start Startscreen --- src/drawables/Background.ts | 2 +- src/drawables/Startscreen.ts | 45 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 src/drawables/Startscreen.ts (limited to 'src/drawables') 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; + } +} -- cgit v1.3.1