@@ -2,6 +2,7 @@ import { DIRS, DOWN, LEFT, RIGHT, UP } from "../util/dir.ts"
22import { loadImage } from "../util/load.ts"
33import { Input , inputQueue } from "./ui/input.ts"
44import { Character , Move , spawnCharacter } from "../model/character.ts"
5+ import { splashColor } from "./field.ts"
56import type { IField , MovePlan } from "../model/types.ts"
67import * as signal from "../util/signal.ts"
78import { bindToggleFullscreenOnce } from "../util/fullscreen.ts"
@@ -20,7 +21,7 @@ function colorCell(
2021 field . colorCell (
2122 i ,
2223 j ,
23- `hsla(${ hue } , ${ sat } %, ${ light } %, ${ alpha + rng ( ) * 0.1 } )` ,
24+ `hsla(${ hue } , ${ sat } %, ${ light } %, ${ alpha + rng ( ) * 0.15 - 0.05 } )` ,
2425 )
2526}
2627
@@ -72,23 +73,21 @@ export class MainCharacter extends Character {
7273 }
7374
7475 const { rng } = seed ( this . i + " " + this . j )
75-
7676 const hue = 333.3
7777 const sat = 59.4
78- const light = 38.6
79-
80- colorCell ( this . i , this . j , hue , sat , light , 0.40 , field , rng )
81-
82- for ( const dir of DIRS ) {
83- for ( let dist = 1 ; dist <= 3 ; dist ++ ) {
84- const [ i , j ] = this . nextGrid ( dir , dist )
85- if ( ! field . canEnterStatic ( i , j ) ) break
86- setTimeout ( ( ) => {
87- colorCell ( i , j , hue , sat , light , 0.24 - dist * 0.06 , field , rng )
88- } , dist * 32 )
89- }
90- }
91-
78+ const light = 32
79+ const alpha = 0.40
80+ splashColor (
81+ field ,
82+ this . i ,
83+ this . j ,
84+ hue ,
85+ sat ,
86+ light ,
87+ alpha ,
88+ 4 ,
89+ rng ,
90+ )
9291 const count = signal . appleCount . get ( )
9392 signal . appleCount . update ( count + 1 )
9493 break
@@ -121,6 +120,14 @@ export class MainCharacter extends Character {
121120 { type : "speed" , change : "4x" } ,
122121 )
123122 for ( const _ of Array ( 30 ) ) {
123+ this . enqueueAction ( {
124+ type : "splash" ,
125+ hue : 280 ,
126+ sat : 40 ,
127+ light : 30 ,
128+ alpha : 0.2 ,
129+ radius : 3 ,
130+ } )
124131 this . enqueueAction ( { type : "go" , dir : this . dir } )
125132 }
126133 this . enqueueAction (
0 commit comments