diff options
Diffstat (limited to 'src/entities/hello_kitty_background.js')
-rw-r--r-- | src/entities/hello_kitty_background.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/entities/hello_kitty_background.js b/src/entities/hello_kitty_background.js index 4d9a81f..70f0b9d 100644 --- a/src/entities/hello_kitty_background.js +++ b/src/entities/hello_kitty_background.js @@ -27,7 +27,8 @@ export class HelloKittyBackground extends Entity { update() { this.position.y += this.speed - if (this.stage == 0 && this.position.y > this.max_down) { + if (this.stage == 0) { + if (this.position.y < this.max_down) return let margin = this.position.y - this.max_down let newPos = new Vector( this.size.x / 2 - this.x_margin, @@ -36,6 +37,8 @@ export class HelloKittyBackground extends Entity { new HelloKittyBackground(newPos) this.stage++ + return } + if (Engine.screen.isOffLimits(this.position, this.size)) this.remove() } } |