From db371d452f3bbdaba4533070b84e774974bfe29c Mon Sep 17 00:00:00 2001 From: eguneys Date: Thu, 4 Jan 2024 22:19:05 +0300 Subject: [PATCH] poems --- content/poems/en.poem | 58 +++++++++++++++++++++++++++++++++++++++++++ src/game.ts | 36 +++++++++++++++++++++++++++ src/poems.ts | 25 +++++++++++++++++++ src/solitaire.ts | 4 ++- 4 files changed, 122 insertions(+), 1 deletion(-) create mode 100644 content/poems/en.poem create mode 100644 src/poems.ts diff --git a/content/poems/en.poem b/content/poems/en.poem new file mode 100644 index 0000000..6ef4c1b --- /dev/null +++ b/content/poems/en.poem @@ -0,0 +1,58 @@ +Shimzy stars, let be yours, +But don’t fall in love little one, +Let it crack the fires beneath you. +You might as well catch one. + +stars, will live onto it, +it is the future as you predicted, +unlike you’ve ever seen before, +surprised?, well well well on you. + +shinzy little star came to me, +and said, yes you are it. +really not really but yes and yes, +earth fall upon graveyards of the future. + +Simple but craving inward, +Fast yet inching its way outward. +Witzy, watzy, shill friend, +This isn’t your usual bedtime blend. + +since the world started spinning, +spin spin all around +overclocked users complain +give us my witz and history back. + +Genes in the bottle, +Looking inside the glass. +How are you qualified? +“I don’t know, factory girl,” alas. + +Simpler times, have been passing, +Let’s keep it really simple, and dollars. +That’s my 2 cents to thisness. + +“Cripple your way up, +It’s not coming fast. But too slow, +you might as well stop. +Just kidding, take your time.” + +“Same guidance, from both approaches. +One is kind, one is light. +Light is starry and shiny. +Kind is bloated and furry.” + +“Let’s come to simpler terms. +You take me, I take you. +But beware of your words. +This is not the old Sparta.” + +“However you like it. +Come and go as you please. +Just one thing to mention in between. +Words are referencing your dogs.” + +“Symbolism is effective. +Interaction into the wild oaks. +They tell me your stories. +Inside the joke teller’s guide to the galaxy.” \ No newline at end of file diff --git a/src/game.ts b/src/game.ts index 41bf855..6ea6777 100644 --- a/src/game.ts +++ b/src/game.ts @@ -29,6 +29,7 @@ import Trans, { languages } from './trans' import { limit_settings, cards_settings, SolitaireStore, GeneralStore } from './store' import { SolitaireResultsStore } from './store' import { GameResults, OverallResults } from './statistics' +import { Poems } from './poems' type RectData = { @@ -89,6 +90,16 @@ class ArrowUpFire extends Play { } export class Background extends Play { + + poem_text!: TransText + + + change_poem() { + this._will_change_poem = true + } + + _will_change_poem: boolean = false + _init() { this.make(RectView, Vec2.make(0, 0), { @@ -99,10 +110,35 @@ export class Background extends Play { + let poem = Poems.one() + + this.poem_text = this.make(TransText, Vec2.make(1920 / 2, 1080), { + no_trans: true, + width: 1000, + height: 700, + key: poem, + center: true, + color: Color.hex(0xb4beb4) + }) + + + } + life: number = 0 + _update() { + this.life += Time.delta + this.poem_text.position.y = 900 + Math.cos(this.life * 0.2) * 400 + + if (this._will_change_poem) { + if (this.poem_text.position.y > 1100) { + this._will_change_poem = false + this.poem_text.text = Poems.one() + } + } + if (Time.on_interval(ticks.seconds * 3)) { for (let i = 0; i < Math.random() * 5; i++) { let x = 400 + Math.random() * 1000 diff --git a/src/poems.ts b/src/poems.ts new file mode 100644 index 0000000..659b15e --- /dev/null +++ b/src/poems.ts @@ -0,0 +1,25 @@ +import en from '../content/poems/en.poem?raw' +import { arr_random } from './util' + +class Poems { + static load = () => { + + + let verses = en.split('\r\n\r\n') + + return new Poems(verses) + + } + + + constructor(readonly verses: string[]) {} + + + one() { + return arr_random(this.verses, Math.random) + } +} + +let poems = Poems.load() + +export { poems as Poems } \ No newline at end of file diff --git a/src/solitaire.ts b/src/solitaire.ts index a9d3c4b..5a492cd 100644 --- a/src/solitaire.ts +++ b/src/solitaire.ts @@ -30,6 +30,7 @@ import { card_sort_key, Settings } from 'lsolitaire' import { Nine } from './nine' import { SolitaireResultsStore } from './store' import { SolitaireGameResult } from './statistics' +import { Poems } from './poems' let rnd_screen_poss = [...Array(50).keys()].map(() => v_random().mul(v_screen.scale(0.8))) @@ -655,7 +656,7 @@ export class SolitairePlay extends Play { let sidebar: SideBar - this.make(Background, Vec2.zero, undefined) + let background = this.make(Background, Vec2.zero, undefined) this.over_confetties.push( this.make(GameOverConfetti, Vec2.make(0, 0), {}) @@ -692,6 +693,7 @@ export class SolitairePlay extends Play { game_over_dialog = undefined } Sound.play('new_game') + background.change_poem() } const on_game_over = (_: Settings, score: number) => {