2022-04-18 01:14:39 +00:00
( ( ) => {
var _ _defProp = Object . defineProperty ;
var _ _name = ( target , value ) => _ _defProp ( target , "name" , { value , configurable : true } ) ;
// node_modules/kaboom/dist/kaboom.mjs
var ir = Object . defineProperty ;
var Hi = Object . defineProperties ;
var zi = Object . getOwnPropertyDescriptors ;
var rr = Object . getOwnPropertySymbols ;
var Ji = Object . prototype . hasOwnProperty ;
var Qi = Object . prototype . propertyIsEnumerable ;
2022-04-24 09:47:31 +00:00
var Nt = /* @__PURE__ */ _ _name ( ( i2 , t , l ) => t in i2 ? ir ( i2 , t , { enumerable : true , configurable : true , writable : true , value : l } ) : i2 [ t ] = l , "Nt" ) ;
var P = /* @__PURE__ */ _ _name ( ( i2 , t ) => {
2022-04-18 01:14:39 +00:00
for ( var l in t || ( t = { } ) )
2022-04-24 09:47:31 +00:00
Ji . call ( t , l ) && Nt ( i2 , l , t [ l ] ) ;
2022-04-18 01:14:39 +00:00
if ( rr )
for ( var l of rr ( t ) )
2022-04-24 09:47:31 +00:00
Qi . call ( t , l ) && Nt ( i2 , l , t [ l ] ) ;
return i2 ;
2022-04-18 01:14:39 +00:00
} , "P" ) ;
2022-04-24 09:47:31 +00:00
var D = /* @__PURE__ */ _ _name ( ( i2 , t ) => Hi ( i2 , zi ( t ) ) , "D" ) ;
var a = /* @__PURE__ */ _ _name ( ( i2 , t ) => ir ( i2 , "name" , { value : t , configurable : true } ) , "a" ) ;
var b = /* @__PURE__ */ _ _name ( ( i2 , t , l ) => ( Nt ( i2 , typeof t != "symbol" ? t + "" : t , l ) , l ) , "b" ) ;
var sr = /* @__PURE__ */ _ _name ( ( i2 , t , l ) => new Promise ( ( w , U ) => {
2022-04-18 01:14:39 +00:00
var p = /* @__PURE__ */ _ _name ( ( q ) => {
try {
A ( l . next ( q ) ) ;
} catch ( V ) {
U ( V ) ;
}
} , "p" ) , S = /* @__PURE__ */ _ _name ( ( q ) => {
try {
A ( l . throw ( q ) ) ;
} catch ( V ) {
U ( V ) ;
}
} , "S" ) , A = /* @__PURE__ */ _ _name ( ( q ) => q . done ? w ( q . value ) : Promise . resolve ( q . value ) . then ( p , S ) , "A" ) ;
2022-04-24 09:47:31 +00:00
A ( ( l = l . apply ( i2 , t ) ) . next ( ) ) ;
2022-04-18 01:14:39 +00:00
} ) , "sr" ) ;
var or = ( ( ) => {
2022-04-24 09:47:31 +00:00
for ( var i2 = new Uint8Array ( 128 ) , t = 0 ; t < 64 ; t ++ )
i2 [ t < 26 ? t + 65 : t < 52 ? t + 71 : t < 62 ? t - 4 : t * 4 - 205 ] = t ;
2022-04-18 01:14:39 +00:00
return ( l ) => {
for ( var w = l . length , U = new Uint8Array ( ( w - ( l [ w - 1 ] == "=" ) - ( l [ w - 2 ] == "=" ) ) * 3 / 4 | 0 ) , p = 0 , S = 0 ; p < w ; ) {
2022-04-24 09:47:31 +00:00
var A = i2 [ l . charCodeAt ( p ++ ) ] , q = i2 [ l . charCodeAt ( p ++ ) ] , V = i2 [ l . charCodeAt ( p ++ ) ] , j = i2 [ l . charCodeAt ( p ++ ) ] ;
2022-04-18 01:14:39 +00:00
U [ S ++ ] = A << 2 | q >> 4 , U [ S ++ ] = q << 4 | V >> 2 , U [ S ++ ] = V << 6 | j ;
}
return U ;
} ;
} ) ( ) ;
var $ = /* @__PURE__ */ _ _name ( class extends Map {
constructor ( ... t ) {
super ( ... t ) ;
b ( this , "_lastID" ) ;
this . _lastID = 0 ;
}
push ( t ) {
let l = this . _lastID ;
return this . set ( l , t ) , this . _lastID ++ , l ;
}
pushd ( t ) {
let l = this . push ( t ) ;
return ( ) => this . delete ( l ) ;
}
} , "$" ) ;
a ( $ , "IDList" ) ;
2022-04-24 09:47:31 +00:00
function jt ( i2 , t ) {
let l = typeof i2 , w = typeof t ;
2022-04-18 01:14:39 +00:00
if ( l !== w )
return false ;
if ( l === "object" && w === "object" ) {
2022-04-24 09:47:31 +00:00
let U = Object . keys ( i2 ) , p = Object . keys ( t ) ;
2022-04-18 01:14:39 +00:00
if ( U . length !== p . length )
return false ;
for ( let S of U ) {
2022-04-24 09:47:31 +00:00
let A = i2 [ S ] , q = t [ S ] ;
2022-04-18 01:14:39 +00:00
if ( ! ( typeof A == "function" && typeof q == "function" ) && ! jt ( A , q ) )
return false ;
}
return true ;
}
2022-04-24 09:47:31 +00:00
return i2 === t ;
2022-04-18 01:14:39 +00:00
}
_ _name ( jt , "jt" ) ;
a ( jt , "deepEq" ) ;
2022-04-24 09:47:31 +00:00
function Yt ( i2 , t ) {
2022-04-18 01:14:39 +00:00
let l = document . createElement ( "a" ) ;
2022-04-24 09:47:31 +00:00
document . body . appendChild ( l ) , l . setAttribute ( "style" , "display: none" ) , l . href = i2 , l . download = t , l . click ( ) , document . body . removeChild ( l ) ;
2022-04-18 01:14:39 +00:00
}
_ _name ( Yt , "Yt" ) ;
a ( Yt , "downloadURL" ) ;
2022-04-24 09:47:31 +00:00
function ur ( i2 , t ) {
let l = URL . createObjectURL ( i2 ) ;
2022-04-18 01:14:39 +00:00
Yt ( l , t ) , URL . revokeObjectURL ( l ) ;
}
_ _name ( ur , "ur" ) ;
a ( ur , "downloadBlob" ) ;
2022-04-24 09:47:31 +00:00
function cr ( i2 ) {
return i2 . match ( /^data:\w+\/\w+;base64,.+/ ) ;
2022-04-18 01:14:39 +00:00
}
_ _name ( cr , "cr" ) ;
a ( cr , "isDataURL" ) ;
var lr = ( ( ) => {
2022-04-24 09:47:31 +00:00
let i2 = 0 ;
return ( ) => i2 ++ ;
2022-04-18 01:14:39 +00:00
} ) ( ) ;
var ar = /* @__PURE__ */ new Set ( ) ;
2022-04-24 09:47:31 +00:00
function B ( i2 , t ) {
ar . has ( i2 ) || ( ar . add ( i2 ) , console . warn ( ` ${ i2 } is deprecated. Use ${ t } instead. ` ) ) ;
2022-04-18 01:14:39 +00:00
}
_ _name ( B , "B" ) ;
a ( B , "deprecateMsg" ) ;
2022-04-24 09:47:31 +00:00
var T = a ( ( i2 , t , l ) => ( ... w ) => ( B ( i2 , t ) , l ( ... w ) ) , "deprecate" ) ;
function he ( i2 ) {
return i2 * Math . PI / 180 ;
2022-04-18 01:14:39 +00:00
}
_ _name ( he , "he" ) ;
a ( he , "deg2rad" ) ;
2022-04-24 09:47:31 +00:00
function Xt ( i2 ) {
return i2 * 180 / Math . PI ;
2022-04-18 01:14:39 +00:00
}
_ _name ( Xt , "Xt" ) ;
a ( Xt , "rad2deg" ) ;
2022-04-24 09:47:31 +00:00
function z ( i2 , t , l ) {
return t > l ? z ( i2 , l , t ) : Math . min ( Math . max ( i2 , t ) , l ) ;
2022-04-18 01:14:39 +00:00
}
_ _name ( z , "z" ) ;
a ( z , "clamp" ) ;
2022-04-24 09:47:31 +00:00
function Ve ( i2 , t , l ) {
return i2 + ( t - i2 ) * l ;
2022-04-18 01:14:39 +00:00
}
_ _name ( Ve , "Ve" ) ;
a ( Ve , "lerp" ) ;
2022-04-24 09:47:31 +00:00
function dt ( i2 , t , l , w , U ) {
return w + ( i2 - t ) / ( l - t ) * ( U - w ) ;
2022-04-18 01:14:39 +00:00
}
_ _name ( dt , "dt" ) ;
a ( dt , "map" ) ;
2022-04-24 09:47:31 +00:00
function dr ( i2 , t , l , w , U ) {
return z ( dt ( i2 , t , l , w , U ) , w , U ) ;
2022-04-18 01:14:39 +00:00
}
_ _name ( dr , "dr" ) ;
a ( dr , "mapc" ) ;
var N = /* @__PURE__ */ _ _name ( class {
constructor ( t = 0 , l = t ) {
b ( this , "x" , 0 ) ;
b ( this , "y" , 0 ) ;
this . x = t , this . y = l ;
}
static fromAngle ( t ) {
let l = he ( t ) ;
return new N ( Math . cos ( l ) , Math . sin ( l ) ) ;
}
clone ( ) {
return new N ( this . x , this . y ) ;
}
add ( ... t ) {
let l = f ( ... t ) ;
return new N ( this . x + l . x , this . y + l . y ) ;
}
sub ( ... t ) {
let l = f ( ... t ) ;
return new N ( this . x - l . x , this . y - l . y ) ;
}
scale ( ... t ) {
let l = f ( ... t ) ;
return new N ( this . x * l . x , this . y * l . y ) ;
}
dist ( ... t ) {
let l = f ( ... t ) ;
return Math . sqrt ( ( this . x - l . x ) * ( this . x - l . x ) + ( this . y - l . y ) * ( this . y - l . y ) ) ;
}
len ( ) {
return this . dist ( new N ( 0 , 0 ) ) ;
}
unit ( ) {
return this . scale ( 1 / this . len ( ) ) ;
}
normal ( ) {
return new N ( this . y , - this . x ) ;
}
dot ( t ) {
return this . x * t . x + this . y * t . y ;
}
angle ( ... t ) {
let l = f ( ... t ) ;
return Xt ( Math . atan2 ( this . y - l . y , this . x - l . x ) ) ;
}
lerp ( t , l ) {
return new N ( Ve ( this . x , t . x , l ) , Ve ( this . y , t . y , l ) ) ;
}
toFixed ( t ) {
return new N ( Number ( this . x . toFixed ( t ) ) , Number ( this . y . toFixed ( t ) ) ) ;
}
eq ( t ) {
return this . x === t . x && this . y === t . y ;
}
toString ( ) {
return ` ( ${ this . x . toFixed ( 2 ) } , ${ this . y . toFixed ( 2 ) } ) ` ;
}
str ( ) {
return this . toString ( ) ;
}
} , "N" ) ;
var L = N ;
a ( L , "Vec2" ) , b ( L , "LEFT" , new N ( - 1 , 0 ) ) , b ( L , "RIGHT" , new N ( 1 , 0 ) ) , b ( L , "UP" , new N ( 0 , - 1 ) ) , b ( L , "DOWN" , new N ( 0 , 1 ) ) ;
2022-04-24 09:47:31 +00:00
function f ( ... i2 ) {
if ( i2 . length === 1 ) {
if ( i2 [ 0 ] instanceof L )
return f ( i2 [ 0 ] . x , i2 [ 0 ] . y ) ;
if ( Array . isArray ( i2 [ 0 ] ) && i2 [ 0 ] . length === 2 )
return f . apply ( null , i2 [ 0 ] ) ;
}
return new L ( ... i2 ) ;
2022-04-18 01:14:39 +00:00
}
_ _name ( f , "f" ) ;
a ( f , "vec2" ) ;
var Fe = /* @__PURE__ */ _ _name ( class {
constructor ( t , l , w ) {
b ( this , "x" , 0 ) ;
b ( this , "y" , 0 ) ;
b ( this , "z" , 0 ) ;
this . x = t , this . y = l , this . z = w ;
}
xy ( ) {
return f ( this . x , this . y ) ;
}
} , "Fe" ) ;
a ( Fe , "Vec3" ) ;
2022-04-24 09:47:31 +00:00
var de = a ( ( i2 , t , l ) => new Fe ( i2 , t , l ) , "vec3" ) ;
2022-04-18 01:14:39 +00:00
var ue = /* @__PURE__ */ _ _name ( class {
constructor ( t , l , w ) {
b ( this , "r" , 255 ) ;
b ( this , "g" , 255 ) ;
b ( this , "b" , 255 ) ;
this . r = z ( t , 0 , 255 ) , this . g = z ( l , 0 , 255 ) , this . b = z ( w , 0 , 255 ) ;
}
static fromArray ( t ) {
return new ue ( t [ 0 ] , t [ 1 ] , t [ 2 ] ) ;
}
clone ( ) {
return new ue ( this . r , this . g , this . b ) ;
}
lighten ( t ) {
return new ue ( this . r + t , this . g + t , this . b + t ) ;
}
darken ( t ) {
return this . lighten ( - t ) ;
}
invert ( ) {
return new ue ( 255 - this . r , 255 - this . g , 255 - this . b ) ;
}
mult ( t ) {
return new ue ( this . r * t . r / 255 , this . g * t . g / 255 , this . b * t . b / 255 ) ;
}
eq ( t ) {
return this . r === t . r && this . g === t . g && this . b === t . b ;
}
str ( ) {
return B ( "str()" , "toString()" ) , ` ( ${ this . r } , ${ this . g } , ${ this . b } ) ` ;
}
toString ( ) {
return ` ( ${ this . r } , ${ this . g } , ${ this . b } ) ` ;
}
static fromHSL ( t , l , w ) {
if ( l == 0 )
return E ( 255 * w , 255 * w , 255 * w ) ;
let U = a ( ( j , X , Y ) => ( Y < 0 && ( Y += 1 ) , Y > 1 && ( Y -= 1 ) , Y < 1 / 6 ? j + ( X - j ) * 6 * Y : Y < 1 / 2 ? X : Y < 2 / 3 ? j + ( X - j ) * ( 2 / 3 - Y ) * 6 : j ) , "hue2rgb" ) , p = w < 0.5 ? w * ( 1 + l ) : w + l - w * l , S = 2 * w - p , A = U ( S , p , t + 1 / 3 ) , q = U ( S , p , t ) , V = U ( S , p , t - 1 / 3 ) ;
return new ue ( Math . round ( A * 255 ) , Math . round ( q * 255 ) , Math . round ( V * 255 ) ) ;
}
} , "ue" ) ;
var v = ue ;
a ( v , "Color" ) , b ( v , "RED" , E ( 255 , 0 , 0 ) ) , b ( v , "GREEN" , E ( 0 , 255 , 0 ) ) , b ( v , "BLUE" , E ( 0 , 0 , 255 ) ) , b ( v , "YELLOW" , E ( 255 , 255 , 0 ) ) , b ( v , "MAGENTA" , E ( 255 , 0 , 255 ) ) , b ( v , "CYAN" , E ( 0 , 255 , 255 ) ) , b ( v , "WHITE" , E ( 255 , 255 , 255 ) ) , b ( v , "BLACK" , E ( 0 , 0 , 0 ) ) ;
2022-04-24 09:47:31 +00:00
function E ( ... i2 ) {
if ( i2 . length === 0 )
2022-04-18 01:14:39 +00:00
return new v ( 255 , 255 , 255 ) ;
2022-04-24 09:47:31 +00:00
if ( i2 . length === 1 ) {
if ( i2 [ 0 ] instanceof v )
return i2 [ 0 ] . clone ( ) ;
if ( Array . isArray ( i2 [ 0 ] ) && i2 [ 0 ] . length === 3 )
return v . fromArray ( i2 [ 0 ] ) ;
2022-04-18 01:14:39 +00:00
}
2022-04-24 09:47:31 +00:00
return new v ( ... i2 ) ;
2022-04-18 01:14:39 +00:00
}
_ _name ( E , "E" ) ;
a ( E , "rgb" ) ;
2022-04-24 09:47:31 +00:00
var fr = a ( ( i2 , t , l ) => v . fromHSL ( i2 , t , l ) , "hsl2rgb" ) ;
2022-04-18 01:14:39 +00:00
var k = /* @__PURE__ */ _ _name ( class {
constructor ( t , l , w , U ) {
b ( this , "x" , 0 ) ;
b ( this , "y" , 0 ) ;
b ( this , "w" , 1 ) ;
b ( this , "h" , 1 ) ;
this . x = t , this . y = l , this . w = w , this . h = U ;
}
scale ( t ) {
return new k ( this . x + this . w * t . x , this . y + this . h * t . y , this . w * t . w , this . h * t . h ) ;
}
clone ( ) {
return new k ( this . x , this . y , this . w , this . h ) ;
}
eq ( t ) {
return this . x === t . x && this . y === t . y && this . w === t . w && this . h === t . h ;
}
toString ( ) {
return ` quad( ${ this . x } , ${ this . y } , ${ this . w } , ${ this . h } ) ` ;
}
} , "k" ) ;
a ( k , "Quad" ) ;
2022-04-24 09:47:31 +00:00
function pr ( i2 , t , l , w ) {
return new k ( i2 , t , l , w ) ;
2022-04-18 01:14:39 +00:00
}
_ _name ( pr , "pr" ) ;
a ( pr , "quad" ) ;
var R = /* @__PURE__ */ _ _name ( class {
constructor ( t ) {
b ( this , "m" , [ 1 , 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 1 ] ) ;
t && ( this . m = t ) ;
}
clone ( ) {
return new R ( this . m ) ;
}
mult ( t ) {
let l = [ ] ;
for ( let w = 0 ; w < 4 ; w ++ )
for ( let U = 0 ; U < 4 ; U ++ )
l [ w * 4 + U ] = this . m [ 0 * 4 + U ] * t . m [ w * 4 + 0 ] + this . m [ 1 * 4 + U ] * t . m [ w * 4 + 1 ] + this . m [ 2 * 4 + U ] * t . m [ w * 4 + 2 ] + this . m [ 3 * 4 + U ] * t . m [ w * 4 + 3 ] ;
return new R ( l ) ;
}
multVec4 ( t ) {
return { x : t . x * this . m [ 0 ] + t . y * this . m [ 4 ] + t . z * this . m [ 8 ] + t . w * this . m [ 12 ] , y : t . x * this . m [ 1 ] + t . y * this . m [ 5 ] + t . z * this . m [ 9 ] + t . w * this . m [ 13 ] , z : t . x * this . m [ 2 ] + t . y * this . m [ 6 ] + t . z * this . m [ 10 ] + t . w * this . m [ 14 ] , w : t . x * this . m [ 3 ] + t . y * this . m [ 7 ] + t . z * this . m [ 11 ] + t . w * this . m [ 15 ] } ;
}
multVec3 ( t ) {
let l = this . multVec4 ( { x : t . x , y : t . y , z : t . z , w : 1 } ) ;
return de ( l . x , l . y , l . z ) ;
}
multVec2 ( t ) {
return f ( t . x * this . m [ 0 ] + t . y * this . m [ 4 ] + 0 * this . m [ 8 ] + 1 * this . m [ 12 ] , t . x * this . m [ 1 ] + t . y * this . m [ 5 ] + 0 * this . m [ 9 ] + 1 * this . m [ 13 ] ) ;
}
static translate ( t ) {
return new R ( [ 1 , 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 1 , 0 , t . x , t . y , 0 , 1 ] ) ;
}
static scale ( t ) {
return new R ( [ t . x , 0 , 0 , 0 , 0 , t . y , 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 1 ] ) ;
}
static rotateX ( t ) {
return t = he ( - t ) , new R ( [ 1 , 0 , 0 , 0 , 0 , Math . cos ( t ) , - Math . sin ( t ) , 0 , 0 , Math . sin ( t ) , Math . cos ( t ) , 0 , 0 , 0 , 0 , 1 ] ) ;
}
static rotateY ( t ) {
return t = he ( - t ) , new R ( [ Math . cos ( t ) , 0 , Math . sin ( t ) , 0 , 0 , 1 , 0 , 0 , - Math . sin ( t ) , 0 , Math . cos ( t ) , 0 , 0 , 0 , 0 , 1 ] ) ;
}
static rotateZ ( t ) {
return t = he ( - t ) , new R ( [ Math . cos ( t ) , - Math . sin ( t ) , 0 , 0 , Math . sin ( t ) , Math . cos ( t ) , 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 1 ] ) ;
}
translate ( t ) {
return this . mult ( R . translate ( t ) ) ;
}
scale ( t ) {
return this . mult ( R . scale ( t ) ) ;
}
rotateX ( t ) {
return this . mult ( R . rotateX ( t ) ) ;
}
rotateY ( t ) {
return this . mult ( R . rotateY ( t ) ) ;
}
rotateZ ( t ) {
return this . mult ( R . rotateZ ( t ) ) ;
}
invert ( ) {
let t = [ ] , l = this . m [ 10 ] * this . m [ 15 ] - this . m [ 14 ] * this . m [ 11 ] , w = this . m [ 9 ] * this . m [ 15 ] - this . m [ 13 ] * this . m [ 11 ] , U = this . m [ 9 ] * this . m [ 14 ] - this . m [ 13 ] * this . m [ 10 ] , p = this . m [ 8 ] * this . m [ 15 ] - this . m [ 12 ] * this . m [ 11 ] , S = this . m [ 8 ] * this . m [ 14 ] - this . m [ 12 ] * this . m [ 10 ] , A = this . m [ 8 ] * this . m [ 13 ] - this . m [ 12 ] * this . m [ 9 ] , q = this . m [ 6 ] * this . m [ 15 ] - this . m [ 14 ] * this . m [ 7 ] , V = this . m [ 5 ] * this . m [ 15 ] - this . m [ 13 ] * this . m [ 7 ] , j = this . m [ 5 ] * this . m [ 14 ] - this . m [ 13 ] * this . m [ 6 ] , X = this . m [ 4 ] * this . m [ 15 ] - this . m [ 12 ] * this . m [ 7 ] , Y = this . m [ 4 ] * this . m [ 14 ] - this . m [ 12 ] * this . m [ 6 ] , an = this . m [ 5 ] * this . m [ 15 ] - this . m [ 13 ] * this . m [ 7 ] , xt = this . m [ 4 ] * this . m [ 13 ] - this . m [ 12 ] * this . m [ 5 ] , vt = this . m [ 6 ] * this . m [ 11 ] - this . m [ 10 ] * this . m [ 7 ] , ve = this . m [ 5 ] * this . m [ 11 ] - this . m [ 9 ] * this . m [ 7 ] , Ee = this . m [ 5 ] * this . m [ 10 ] - this . m [ 9 ] * this . m [ 6 ] , Te = this . m [ 4 ] * this . m [ 11 ] - this . m [ 8 ] * this . m [ 7 ] , J = this . m [ 4 ] * this . m [ 10 ] - this . m [ 8 ] * this . m [ 6 ] , $e = this . m [ 4 ] * this . m [ 9 ] - this . m [ 8 ] * this . m [ 5 ] ;
t [ 0 ] = this . m [ 5 ] * l - this . m [ 6 ] * w + this . m [ 7 ] * U , t [ 4 ] = - ( this . m [ 4 ] * l - this . m [ 6 ] * p + this . m [ 7 ] * S ) , t [ 8 ] = this . m [ 4 ] * w - this . m [ 5 ] * p + this . m [ 7 ] * A , t [ 12 ] = - ( this . m [ 4 ] * U - this . m [ 5 ] * S + this . m [ 6 ] * A ) , t [ 1 ] = - ( this . m [ 1 ] * l - this . m [ 2 ] * w + this . m [ 3 ] * U ) , t [ 5 ] = this . m [ 0 ] * l - this . m [ 2 ] * p + this . m [ 3 ] * S , t [ 9 ] = - ( this . m [ 0 ] * w - this . m [ 1 ] * p + this . m [ 3 ] * A ) , t [ 13 ] = this . m [ 0 ] * U - this . m [ 1 ] * S + this . m [ 2 ] * A , t [ 2 ] = this . m [ 1 ] * q - this . m [ 2 ] * V + this . m [ 3 ] * j , t [ 6 ] = - ( this . m [ 0 ] * q - this . m [ 2 ] * X + this . m [ 3 ] * Y ) , t [ 10 ] = this . m [ 0 ] * an - this . m [ 1 ] * X + this . m [ 3 ] * xt , t [ 14 ] = - ( this . m [ 0 ] * j - this . m [ 1 ] * Y + this . m [ 2 ] * xt ) , t [ 3 ] = - ( this . m [ 1 ] * vt - this . m [ 2 ] * ve + this . m [ 3 ] * Ee ) , t [ 7 ] = this . m [ 0 ] * vt - this . m [ 2 ] * Te + this . m [ 3 ] * J , t [ 11 ] = - ( this . m [ 0 ] * ve - this . m [ 1 ] * Te + this . m [ 3 ] * $e ) , t [ 15 ] = this . m [ 0 ] * Ee - this . m [ 1 ] * J + this . m [ 2 ] * $e ;
let Et = this . m [ 0 ] * t [ 0 ] + this . m [ 1 ] * t [ 4 ] + this . m [ 2 ] * t [ 8 ] + this . m [ 3 ] * t [ 12 ] ;
for ( let Se = 0 ; Se < 4 ; Se ++ )
for ( let Ce = 0 ; Ce < 4 ; Ce ++ )
t [ Se * 4 + Ce ] *= 1 / Et ;
return new R ( t ) ;
}
toString ( ) {
return this . m . toString ( ) ;
}
} , "R" ) ;
a ( R , "Mat4" ) ;
2022-04-24 09:47:31 +00:00
function Kt ( i2 , t , l , w = Math . sin ) {
return i2 + ( w ( l ) + 1 ) / 2 * ( t - i2 ) ;
2022-04-18 01:14:39 +00:00
}
_ _name ( Kt , "Kt" ) ;
a ( Kt , "wave" ) ;
var Zi = 1103515245 ;
var es = 12345 ;
var hr = 2147483648 ;
var be = /* @__PURE__ */ _ _name ( class {
constructor ( t ) {
b ( this , "seed" ) ;
this . seed = t ;
}
gen ( ... t ) {
if ( t . length === 0 )
return this . seed = ( Zi * this . seed + es ) % hr , this . seed / hr ;
if ( t . length === 1 ) {
if ( typeof t [ 0 ] == "number" )
return this . gen ( 0 , t [ 0 ] ) ;
if ( t [ 0 ] instanceof L )
return this . gen ( f ( 0 , 0 ) , t [ 0 ] ) ;
if ( t [ 0 ] instanceof v )
return this . gen ( E ( 0 , 0 , 0 ) , t [ 0 ] ) ;
} else if ( t . length === 2 ) {
if ( typeof t [ 0 ] == "number" && typeof t [ 1 ] == "number" )
return this . gen ( ) * ( t [ 1 ] - t [ 0 ] ) + t [ 0 ] ;
if ( t [ 0 ] instanceof L && t [ 1 ] instanceof L )
return f ( this . gen ( t [ 0 ] . x , t [ 1 ] . x ) , this . gen ( t [ 0 ] . y , t [ 1 ] . y ) ) ;
if ( t [ 0 ] instanceof v && t [ 1 ] instanceof v )
return E ( this . gen ( t [ 0 ] . r , t [ 1 ] . r ) , this . gen ( t [ 0 ] . g , t [ 1 ] . g ) , this . gen ( t [ 0 ] . b , t [ 1 ] . b ) ) ;
}
}
} , "be" ) ;
a ( be , "RNG" ) ;
var $t = new be ( Date . now ( ) ) ;
2022-04-24 09:47:31 +00:00
function mr ( i2 ) {
return B ( "rng()" , "new RNG()" ) , new be ( i2 ) ;
2022-04-18 01:14:39 +00:00
}
_ _name ( mr , "mr" ) ;
a ( mr , "rng" ) ;
2022-04-24 09:47:31 +00:00
function wr ( i2 ) {
return i2 != null && ( $t . seed = i2 ) , $t . seed ;
2022-04-18 01:14:39 +00:00
}
_ _name ( wr , "wr" ) ;
a ( wr , "randSeed" ) ;
2022-04-24 09:47:31 +00:00
function Ge ( ... i2 ) {
return $t . gen ( ... i2 ) ;
2022-04-18 01:14:39 +00:00
}
_ _name ( Ge , "Ge" ) ;
a ( Ge , "rand" ) ;
2022-04-24 09:47:31 +00:00
function Ht ( ... i2 ) {
return Math . floor ( Ge ( ... i2 ) ) ;
2022-04-18 01:14:39 +00:00
}
_ _name ( Ht , "Ht" ) ;
a ( Ht , "randi" ) ;
2022-04-24 09:47:31 +00:00
function gr ( i2 ) {
return Ge ( ) <= i2 ;
2022-04-18 01:14:39 +00:00
}
_ _name ( gr , "gr" ) ;
a ( gr , "chance" ) ;
2022-04-24 09:47:31 +00:00
function Ur ( i2 ) {
return i2 [ Ht ( i2 . length ) ] ;
2022-04-18 01:14:39 +00:00
}
_ _name ( Ur , "Ur" ) ;
a ( Ur , "choose" ) ;
2022-04-24 09:47:31 +00:00
function yr ( i2 , t ) {
return i2 . p2 . x >= t . p1 . x && i2 . p1 . x <= t . p2 . x && i2 . p2 . y >= t . p1 . y && i2 . p1 . y <= t . p2 . y ;
2022-04-18 01:14:39 +00:00
}
_ _name ( yr , "yr" ) ;
a ( yr , "testRectRect2" ) ;
2022-04-24 09:47:31 +00:00
function zt ( i2 , t ) {
return i2 . p2 . x > t . p1 . x && i2 . p1 . x < t . p2 . x && i2 . p2 . y > t . p1 . y && i2 . p1 . y < t . p2 . y ;
2022-04-18 01:14:39 +00:00
}
_ _name ( zt , "zt" ) ;
a ( zt , "testRectRect" ) ;
2022-04-24 09:47:31 +00:00
function Jt ( i2 , t ) {
if ( i2 . p1 . x === i2 . p2 . x && i2 . p1 . y === i2 . p2 . y || t . p1 . x === t . p2 . x && t . p1 . y === t . p2 . y )
2022-04-18 01:14:39 +00:00
return null ;
2022-04-24 09:47:31 +00:00
let l = ( t . p2 . y - t . p1 . y ) * ( i2 . p2 . x - i2 . p1 . x ) - ( t . p2 . x - t . p1 . x ) * ( i2 . p2 . y - i2 . p1 . y ) ;
2022-04-18 01:14:39 +00:00
if ( l === 0 )
return null ;
2022-04-24 09:47:31 +00:00
let w = ( ( t . p2 . x - t . p1 . x ) * ( i2 . p1 . y - t . p1 . y ) - ( t . p2 . y - t . p1 . y ) * ( i2 . p1 . x - t . p1 . x ) ) / l , U = ( ( i2 . p2 . x - i2 . p1 . x ) * ( i2 . p1 . y - t . p1 . y ) - ( i2 . p2 . y - i2 . p1 . y ) * ( i2 . p1 . x - t . p1 . x ) ) / l ;
2022-04-18 01:14:39 +00:00
return w < 0 || w > 1 || U < 0 || U > 1 ? null : w ;
}
_ _name ( Jt , "Jt" ) ;
a ( Jt , "testLineLineT" ) ;
2022-04-24 09:47:31 +00:00
function ce ( i2 , t ) {
let l = Jt ( i2 , t ) ;
return l ? f ( i2 . p1 . x + l * ( i2 . p2 . x - i2 . p1 . x ) , i2 . p1 . y + l * ( i2 . p2 . y - i2 . p1 . y ) ) : null ;
2022-04-18 01:14:39 +00:00
}
_ _name ( ce , "ce" ) ;
a ( ce , "testLineLine" ) ;
2022-04-24 09:47:31 +00:00
function ft ( i2 , t ) {
return ae ( i2 , t . p1 ) || ae ( i2 , t . p2 ) ? true : ! ! ce ( t , new le ( i2 . p1 , f ( i2 . p2 . x , i2 . p1 . y ) ) ) || ! ! ce ( t , new le ( f ( i2 . p2 . x , i2 . p1 . y ) , i2 . p2 ) ) || ! ! ce ( t , new le ( i2 . p2 , f ( i2 . p1 . x , i2 . p2 . y ) ) ) || ! ! ce ( t , new le ( f ( i2 . p1 . x , i2 . p2 . y ) , i2 . p1 ) ) ;
2022-04-18 01:14:39 +00:00
}
_ _name ( ft , "ft" ) ;
a ( ft , "testRectLine" ) ;
2022-04-24 09:47:31 +00:00
function ae ( i2 , t ) {
return t . x > i2 . p1 . x && t . x < i2 . p2 . x && t . y > i2 . p1 . y && t . y < i2 . p2 . y ;
2022-04-18 01:14:39 +00:00
}
_ _name ( ae , "ae" ) ;
a ( ae , "testRectPoint" ) ;
2022-04-24 09:47:31 +00:00
function br ( i2 , t ) {
let l = Math . max ( i2 . p1 . x , Math . min ( t . center . x , i2 . p2 . x ) ) , w = Math . max ( i2 . p1 . y , Math . min ( t . center . y , i2 . p2 . y ) ) ;
2022-04-18 01:14:39 +00:00
return f ( l , w ) . dist ( t . center ) <= t . radius ;
}
_ _name ( br , "br" ) ;
a ( br , "testRectCircle" ) ;
2022-04-24 09:47:31 +00:00
function pt ( i2 , t ) {
return wt ( t , [ i2 . p1 , f ( i2 . p2 . x , i2 . p1 . y ) , i2 . p2 , f ( i2 . p1 . x , i2 . p2 . y ) ] ) ;
2022-04-18 01:14:39 +00:00
}
_ _name ( pt , "pt" ) ;
a ( pt , "testRectPolygon" ) ;
2022-04-24 09:47:31 +00:00
function xr ( i2 , t ) {
2022-04-18 01:14:39 +00:00
return false ;
}
_ _name ( xr , "xr" ) ;
a ( xr , "testLinePoint" ) ;
2022-04-24 09:47:31 +00:00
function vr ( i2 , t ) {
2022-04-18 01:14:39 +00:00
return false ;
}
_ _name ( vr , "vr" ) ;
a ( vr , "testLineCircle" ) ;
2022-04-24 09:47:31 +00:00
function _e ( i2 , t ) {
if ( xe ( t , i2 . p1 ) || xe ( t , i2 . p2 ) )
2022-04-18 01:14:39 +00:00
return true ;
for ( let l = 0 ; l < t . length ; l ++ ) {
let w = t [ l ] , U = t [ ( l + 1 ) % t . length ] ;
2022-04-24 09:47:31 +00:00
if ( ce ( i2 , { p1 : w , p2 : U } ) )
2022-04-18 01:14:39 +00:00
return true ;
}
return false ;
}
_ _name ( _e , "_e" ) ;
a ( _e , "testLinePolygon" ) ;
2022-04-24 09:47:31 +00:00
function mt ( i2 , t ) {
return i2 . center . dist ( t ) < i2 . radius ;
2022-04-18 01:14:39 +00:00
}
_ _name ( mt , "mt" ) ;
a ( mt , "testCirclePoint" ) ;
2022-04-24 09:47:31 +00:00
function Qt ( i2 , t ) {
return i2 . center . dist ( t . center ) < i2 . radius + t . radius ;
2022-04-18 01:14:39 +00:00
}
_ _name ( Qt , "Qt" ) ;
a ( Qt , "testCircleCircle" ) ;
2022-04-24 09:47:31 +00:00
function Er ( i2 , t ) {
2022-04-18 01:14:39 +00:00
return false ;
}
_ _name ( Er , "Er" ) ;
a ( Er , "testCirclePolygon" ) ;
2022-04-24 09:47:31 +00:00
function wt ( i2 , t ) {
for ( let l = 0 ; l < i2 . length ; l ++ ) {
let w = { p1 : i2 [ l ] , p2 : i2 [ ( l + 1 ) % i2 . length ] } ;
2022-04-18 01:14:39 +00:00
if ( _e ( w , t ) )
return true ;
}
return false ;
}
_ _name ( wt , "wt" ) ;
a ( wt , "testPolygonPolygon" ) ;
2022-04-24 09:47:31 +00:00
function xe ( i2 , t ) {
2022-04-18 01:14:39 +00:00
let l = false ;
2022-04-24 09:47:31 +00:00
for ( let w = 0 , U = i2 . length - 1 ; w < i2 . length ; U = w ++ )
i2 [ w ] . y > t . y != i2 [ U ] . y > t . y && t . x < ( i2 [ U ] . x - i2 [ w ] . x ) * ( t . y - i2 [ w ] . y ) / ( i2 [ U ] . y - i2 [ w ] . y ) + i2 [ w ] . x && ( l = ! l ) ;
2022-04-18 01:14:39 +00:00
return l ;
}
_ _name ( xe , "xe" ) ;
a ( xe , "testPolygonPoint" ) ;
2022-04-24 09:47:31 +00:00
function ts ( i2 , t ) {
return i2 . eq ( t ) ;
2022-04-18 01:14:39 +00:00
}
_ _name ( ts , "ts" ) ;
a ( ts , "testPointPoint" ) ;
2022-04-24 09:47:31 +00:00
function gt ( i2 , t ) {
switch ( i2 . shape ) {
2022-04-18 01:14:39 +00:00
case "rect" :
2022-04-24 09:47:31 +00:00
return zt ( t , i2 ) ;
2022-04-18 01:14:39 +00:00
case "line" :
2022-04-24 09:47:31 +00:00
return ft ( t , i2 ) ;
2022-04-18 01:14:39 +00:00
case "circle" :
2022-04-24 09:47:31 +00:00
return br ( t , i2 ) ;
2022-04-18 01:14:39 +00:00
case "polygon" :
2022-04-24 09:47:31 +00:00
return pt ( t , i2 . pts ) ;
2022-04-18 01:14:39 +00:00
case "point" :
2022-04-24 09:47:31 +00:00
return ae ( t , i2 . pt ) ;
2022-04-18 01:14:39 +00:00
}
2022-04-24 09:47:31 +00:00
throw new Error ( ` Unknown area shape: ${ i2 . shape } ` ) ;
2022-04-18 01:14:39 +00:00
}
_ _name ( gt , "gt" ) ;
a ( gt , "testAreaRect" ) ;
2022-04-24 09:47:31 +00:00
function Zt ( i2 , t ) {
switch ( i2 . shape ) {
2022-04-18 01:14:39 +00:00
case "rect" :
2022-04-24 09:47:31 +00:00
return ft ( i2 , t ) ;
2022-04-18 01:14:39 +00:00
case "line" :
2022-04-24 09:47:31 +00:00
return Boolean ( ce ( i2 , t ) ) ;
2022-04-18 01:14:39 +00:00
case "circle" :
2022-04-24 09:47:31 +00:00
return vr ( t , i2 ) ;
2022-04-18 01:14:39 +00:00
case "polygon" :
2022-04-24 09:47:31 +00:00
return _e ( t , i2 . pts ) ;
2022-04-18 01:14:39 +00:00
case "point" :
2022-04-24 09:47:31 +00:00
return xr ( t , i2 . pt ) ;
2022-04-18 01:14:39 +00:00
}
2022-04-24 09:47:31 +00:00
throw new Error ( ` Unknown area shape: ${ i2 . shape } ` ) ;
2022-04-18 01:14:39 +00:00
}
_ _name ( Zt , "Zt" ) ;
a ( Zt , "testAreaLine" ) ;
2022-04-24 09:47:31 +00:00
function en ( i2 , t ) {
switch ( i2 . shape ) {
2022-04-18 01:14:39 +00:00
case "rect" :
2022-04-24 09:47:31 +00:00
return br ( i2 , t ) ;
2022-04-18 01:14:39 +00:00
case "line" :
2022-04-24 09:47:31 +00:00
return vr ( i2 , t ) ;
2022-04-18 01:14:39 +00:00
case "circle" :
2022-04-24 09:47:31 +00:00
return Qt ( i2 , t ) ;
2022-04-18 01:14:39 +00:00
case "polygon" :
2022-04-24 09:47:31 +00:00
return Er ( t , i2 . pts ) ;
2022-04-18 01:14:39 +00:00
case "point" :
2022-04-24 09:47:31 +00:00
return mt ( t , i2 . pt ) ;
2022-04-18 01:14:39 +00:00
}
2022-04-24 09:47:31 +00:00
throw new Error ( ` Unknown area shape: ${ i2 . shape } ` ) ;
2022-04-18 01:14:39 +00:00
}
_ _name ( en , "en" ) ;
a ( en , "testAreaCircle" ) ;
2022-04-24 09:47:31 +00:00
function tn ( i2 , t ) {
switch ( i2 . shape ) {
2022-04-18 01:14:39 +00:00
case "rect" :
2022-04-24 09:47:31 +00:00
return pt ( i2 , t ) ;
2022-04-18 01:14:39 +00:00
case "line" :
2022-04-24 09:47:31 +00:00
return _e ( i2 , t ) ;
2022-04-18 01:14:39 +00:00
case "circle" :
2022-04-24 09:47:31 +00:00
return Er ( i2 , t ) ;
2022-04-18 01:14:39 +00:00
case "polygon" :
2022-04-24 09:47:31 +00:00
return wt ( t , i2 . pts ) ;
2022-04-18 01:14:39 +00:00
case "point" :
2022-04-24 09:47:31 +00:00
return xe ( t , i2 . pt ) ;
2022-04-18 01:14:39 +00:00
}
2022-04-24 09:47:31 +00:00
throw new Error ( ` Unknown area shape: ${ i2 . shape } ` ) ;
2022-04-18 01:14:39 +00:00
}
_ _name ( tn , "tn" ) ;
a ( tn , "testAreaPolygon" ) ;
2022-04-24 09:47:31 +00:00
function Ut ( i2 , t ) {
switch ( i2 . shape ) {
2022-04-18 01:14:39 +00:00
case "rect" :
2022-04-24 09:47:31 +00:00
return ae ( i2 , t ) ;
2022-04-18 01:14:39 +00:00
case "line" :
2022-04-24 09:47:31 +00:00
return xr ( i2 , t ) ;
2022-04-18 01:14:39 +00:00
case "circle" :
2022-04-24 09:47:31 +00:00
return mt ( i2 , t ) ;
2022-04-18 01:14:39 +00:00
case "polygon" :
2022-04-24 09:47:31 +00:00
return xe ( i2 . pts , t ) ;
2022-04-18 01:14:39 +00:00
case "point" :
2022-04-24 09:47:31 +00:00
return ts ( i2 . pt , t ) ;
2022-04-18 01:14:39 +00:00
}
2022-04-24 09:47:31 +00:00
throw new Error ( ` Unknown area shape: ${ i2 . shape } ` ) ;
2022-04-18 01:14:39 +00:00
}
_ _name ( Ut , "Ut" ) ;
a ( Ut , "testAreaPoint" ) ;
2022-04-24 09:47:31 +00:00
function nn ( i2 , t ) {
2022-04-18 01:14:39 +00:00
switch ( t . shape ) {
case "rect" :
2022-04-24 09:47:31 +00:00
return gt ( i2 , t ) ;
2022-04-18 01:14:39 +00:00
case "line" :
2022-04-24 09:47:31 +00:00
return Zt ( i2 , t ) ;
2022-04-18 01:14:39 +00:00
case "circle" :
2022-04-24 09:47:31 +00:00
return en ( i2 , t ) ;
2022-04-18 01:14:39 +00:00
case "polygon" :
2022-04-24 09:47:31 +00:00
return tn ( i2 , t . pts ) ;
2022-04-18 01:14:39 +00:00
case "point" :
2022-04-24 09:47:31 +00:00
return Ut ( i2 , t . pt ) ;
2022-04-18 01:14:39 +00:00
}
throw new Error ( ` Unknown area shape: ${ t . shape } ` ) ;
}
_ _name ( nn , "nn" ) ;
a ( nn , "testAreaArea" ) ;
2022-04-24 09:47:31 +00:00
function yt ( i2 , t ) {
return { p1 : f ( i2 . p1 . x - t . p2 . x , i2 . p1 . y - t . p2 . y ) , p2 : f ( i2 . p2 . x - t . p1 . x , i2 . p2 . y - t . p1 . y ) } ;
2022-04-18 01:14:39 +00:00
}
_ _name ( yt , "yt" ) ;
a ( yt , "minkDiff" ) ;
var le = /* @__PURE__ */ _ _name ( class {
constructor ( t , l ) {
b ( this , "p1" ) ;
b ( this , "p2" ) ;
this . p1 = t , this . p2 = l ;
}
} , "le" ) ;
a ( le , "Line" ) ;
var ke = /* @__PURE__ */ _ _name ( class {
constructor ( t , l ) {
b ( this , "p1" ) ;
b ( this , "p2" ) ;
this . p1 = t , this . p2 = l ;
}
} , "ke" ) ;
a ( ke , "Rect" ) ;
var ht = /* @__PURE__ */ _ _name ( class {
constructor ( t , l ) {
b ( this , "center" ) ;
b ( this , "radius" ) ;
this . center = t , this . radius = l ;
}
} , "ht" ) ;
a ( ht , "Circle" ) ;
var Be = /* @__PURE__ */ _ _name ( class {
constructor ( ) {
b ( this , "buf" , [ ] ) ;
b ( this , "timer" , 0 ) ;
b ( this , "fps" , 0 ) ;
}
tick ( t ) {
this . buf . push ( 1 / t ) , this . timer += t , this . timer >= 1 && ( this . timer = 0 , this . fps = Math . round ( this . buf . reduce ( ( l , w ) => l + w ) / this . buf . length ) , this . buf = [ ] ) ;
}
} , "Be" ) ;
a ( Be , "FPSCounter" ) ;
var fe = /* @__PURE__ */ _ _name ( class {
constructor ( t , l ) {
b ( this , "time" ) ;
b ( this , "action" ) ;
b ( this , "finished" , false ) ;
b ( this , "paused" , false ) ;
this . time = t , this . action = l ;
}
tick ( t ) {
return this . finished || this . paused ? false : ( this . time -= t , this . time <= 0 ? ( this . action ( ) , this . finished = true , this . time = 0 , true ) : false ) ;
}
reset ( t ) {
this . time = t , this . finished = false ;
}
} , "fe" ) ;
a ( fe , "Timer" ) ;
var Tr = " data : image / png ; base64 , iVBORw0KGgoAAAANSUhEUgAAA1cAAAFyCAMAAAAu4tBuAAAAAXNSR0IArs4c6QAAAE5QTFRFAAAA ////////////////////////////////////////////////////////////////////////////////////////////////////kJcbLQAAABl0Uk5TABAgLzBAUF9gb3B/gI+Qn6CvsL/Az9Df77brr10AAEaZSURBVHja7V3ZgqQosxaO2JRJuSS/Dbz/i54LN9QICEytrJwmrma6LAshvtiIpSgyZcqUKVOmTJkyZcqUKVOmTJkyZcqUKYE4y3uQKdPFqDLOfedtyJTpUtLOOSffvgyhlOTv341SiETtXRJWXWaL4J8j45xz7dth5ZxzJsZ+rJJyx/fXcqx2zpkkeD+cFbFnvhPf+W/ZSzzj6mZcuTJ8Ato555xruW/EmvLCM3apyvvhnNOEb8vAgunLOtfzfxpXZbV8PxfsFlyJ2BGMZKv53zrnnGXvw9XDOedM5CHpMrBCW+OafxlXD+dsufwngU0eZlgf+jKaxXHFYyw80wSsKoZGJptW61ZV/BZc0diitCQj9591QiLcx8s095SxT8IVc4vFw0ky5ts59/RBUb+Eq8qHlbN8XTuuLoRef0PL63HFrXPO/SXCr88wgjcmIBhZrUeh1ArqO7+se5AspGYw1hrdVOyduOIrriTlN7jP8tw551RIpH8755xTdYXJJuOcc1bxUtoF1jIIA/a9gSJFxSbiSlMNvMa5mGD5h9VVQDCa9fiIXtgj7qcXRVFI7832m/8KXCnKb3TOOTf4cqkOCCWf/4dWIvpsZGFunXM2qq74X7cjW16LKxn3CTcItNkSBNWVJJn+zv657EyYTha5P4CrhvIbg/MiZUPoYyuzB4Az1f4h5R2AmkTSuIeYGjzAarEeL8IVM3Sfe7QY2wwlSF0xEqxICn88kxiuuEkXuT+Aq47wG8z36Mf/YSRrbfpOBqk/7ukuMR8LD8pC51opFn2or8TVI0XS1XTd9s/Q5DJjnPR1ZAtBOpPoc2dE7i/BlfAFjMDtNfbXgcTjuJLBU5lEkhEbnciuw9UoGmXSNusMpr1x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egrsVVLQjuh+5+uoK75p8BqOC78v2rvNNlKq/gbuFZSg9V6HjjkqasjgqGtfA3OtIVkrI4XcO4iyikI0q1pexO1n3KdKWsJyOJdKXsUtqSE7yeXhKeM+dxlDyqeZekrGn1wuyFuNGU8jljMgO7FSNdVjyxTEVbUzZn1k1Jr51VRVOOuDp8UcjrC5vzQD/eenIMcdmnxrhpM//LOTMMl5qmR3g6dwbOjuUHMoYtO86Qqj7CY60omDDJ7vBBKc9wYs67ts0eUuXdy96cPvwRTEnZehuVsUE4re2k97ebtiuYGIwJRvetBSGcN64k7SGhTeugy9k0Uc5sEObBkYSZDtaGJM3qeZJBH50GIZuKVCxJC1Nl8N6cQPJgb9d+92HgOImoQozZpOjd7AGEcB4hkrwg6JtdB/2Yh35/Os00IPZ2Z4M8HJLMFR9nbuztxmqV9RznAu6TTLI3MqdyRJO7ENbUm2ZvMQeEfptVLUl9s4DXxdy09haOOIMzwd647dR2Bn8ZdfLlyeO0nmxyhxxHgyS1bThix9EhCWnFORLH0SJJ9XwWlqQHE2iRBFRceiSBOM47SNKI8gaSvNH/DuJKfo//p5wt3O0zWfIXmcC88FUsLZkAAAAASUVORK5CYII=" ;
var Pr = { ArrowLeft : "left" , ArrowRight : "right" , ArrowUp : "up" , ArrowDown : "down" , " " : "space" } ;
var Dr = [ "left" , "middle" , "right" , "back" , "forward" ] ;
var ls = [ "space" , "left" , "right" , "up" , "down" , "tab" , "f1" , "f2" , "f3" , "f4" , "f5" , "f6" , "f7" , "f8" , "f9" , "f10" , "f11" , "s" ] ;
var Ar = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" ;
var hs = " \u263A\u263B\u2665\u2666\u2663\u2660\u2022\u25D8\u25CB\u25D9\u2642\u2640\u266A\u266B\u263C\u25BA\u25C4\u2195\u203C\xB6\xA7\u25AC\u21A8\u2191\u2193\u2192\u2190\u221F\u2194\u25B2\u25BC !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u2302\xC7\xFC\xE9\xE2\xE4\xE0\xE5\xE7\xEA\xEB\xE8\xEF\xEE\xEC\xC4\xC5\xC9\xE6\xC6\xF4\xF6\xF2\xFB\xF9\xFF\xD6\xDC\xA2\xA3\xA5\u20A7\u0192\xE1\xED\xF3\xFA\xF1\xD1\xAA\xBA\xBF\u2310\xAC\xBD\xBC\xA1\xAB\xBB\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u03B1\xDF\u0393\u03C0\u03A3\u03C3\xB5\u03C4\u03A6\u0398\u03A9\u03B4\u221E\u03C6\u03B5\u2229\u2261\xB1\u2265\u2264\u2320\u2321\xF7\u2248\xB0\u2219\xB7\u221A\u207F\xB2\u25A0" ;
var Or = 0 ;
var Ir = 3 ;
var ds = 0 ;
var fs = 3 ;
var ps = - 1200 ;
var ms = 1200 ;
var Ne = "topleft" ;
var Vr = 1600 ;
var bt = 65536 ;
var Fr = 64 ;
var ws = "apl386o" ;
var rn = "sink" ;
var je = 9 ;
var gs = `
attribute vec3 a _pos ;
attribute vec2 a _uv ;
attribute vec4 a _color ;
varying vec3 v _pos ;
varying vec2 v _uv ;
varying vec4 v _color ;
vec4 def _vert ( ) {
return vec4 ( a _pos , 1.0 ) ;
}
{ { user } }
void main ( ) {
vec4 pos = vert ( a _pos , a _uv , a _color ) ;
v _pos = a _pos ;
v _uv = a _uv ;
v _color = a _color ;
gl _Position = pos ;
}
` ;
var Us = `
precision mediump float ;
varying vec3 v _pos ;
varying vec2 v _uv ;
varying vec4 v _color ;
uniform sampler2D u _tex ;
vec4 def _frag ( ) {
return v _color * texture2D ( u _tex , v _uv ) ;
}
{ { user } }
void main ( ) {
gl _FragColor = frag ( v _pos , v _uv , v _color , u _tex ) ;
if ( gl _FragColor . a == 0.0 ) {
discard ;
}
}
` ;
var sn = `
vec4 vert ( vec3 pos , vec2 uv , vec4 color ) {
return def _vert ( ) ;
}
` ;
var on = `
vec4 frag ( vec3 pos , vec2 uv , vec4 color , sampler2D tex ) {
return def _frag ( ) ;
}
` ;
var ys = /* @__PURE__ */ new Set ( [ "id" , "require" ] ) ;
var bs = /* @__PURE__ */ new Set ( [ "add" , "load" , "update" , "draw" , "destroy" , "inspect" ] ) ;
2022-04-24 09:47:31 +00:00
function kr ( i2 ) {
return i2 === "pressed" || i2 === "rpressed" ? "down" : i2 === "released" ? "up" : i2 ;
2022-04-18 01:14:39 +00:00
}
_ _name ( kr , "kr" ) ;
a ( kr , "processButtonState" ) ;
2022-04-24 09:47:31 +00:00
function xs ( i2 ) {
i2 . requestFullscreen ? i2 . requestFullscreen ( ) : i2 . webkitRequestFullscreen && i2 . webkitRequestFullscreen ( ) ;
2022-04-18 01:14:39 +00:00
}
_ _name ( xs , "xs" ) ;
a ( xs , "enterFullscreen" ) ;
function vs ( ) {
document . exitFullscreen ? document . exitFullscreen ( ) : document . webkitExitFullScreen && document . webkitExitFullScreen ( ) ;
}
_ _name ( vs , "vs" ) ;
a ( vs , "exitFullscreen" ) ;
function Es ( ) {
return document . fullscreenElement || document . webkitFullscreenElement ;
}
_ _name ( Es , "Es" ) ;
a ( Es , "getFullscreenElement" ) ;
2022-04-24 09:47:31 +00:00
function Ye ( i2 ) {
switch ( i2 ) {
2022-04-18 01:14:39 +00:00
case "topleft" :
return f ( - 1 , - 1 ) ;
case "top" :
return f ( 0 , - 1 ) ;
case "topright" :
return f ( 1 , - 1 ) ;
case "left" :
return f ( - 1 , 0 ) ;
case "center" :
return f ( 0 , 0 ) ;
case "right" :
return f ( 1 , 0 ) ;
case "botleft" :
return f ( - 1 , 1 ) ;
case "bot" :
return f ( 0 , 1 ) ;
case "botright" :
return f ( 1 , 1 ) ;
default :
2022-04-24 09:47:31 +00:00
return i2 ;
2022-04-18 01:14:39 +00:00
}
}
_ _name ( Ye , "Ye" ) ;
a ( Ye , "originPt" ) ;
function Gr ( ) {
return new AudioBuffer ( { length : 1 , numberOfChannels : 1 , sampleRate : 44100 } ) ;
}
_ _name ( Gr , "Gr" ) ;
a ( Gr , "createEmptyAudioBuffer" ) ;
2022-04-24 09:47:31 +00:00
var no = a ( ( i2 = { } ) => {
2022-04-18 01:14:39 +00:00
let t = ( ( ) => {
var s , o , d ;
2022-04-24 09:47:31 +00:00
let e = ( s = i2 . root ) != null ? s : document . body ;
2022-04-18 01:14:39 +00:00
e === document . body && ( document . body . style . width = "100%" , document . body . style . height = "100%" , document . body . style . margin = "0px" , document . documentElement . style . width = "100%" , document . documentElement . style . height = "100%" ) ;
2022-04-24 09:47:31 +00:00
let n = ( o = i2 . canvas ) != null ? o : ( ( ) => {
let h2 = document . createElement ( "canvas" ) ;
return e . appendChild ( h2 ) , h2 ;
} ) ( ) , r = ( d = i2 . scale ) != null ? d : 1 ;
i2 . width && i2 . height && ! i2 . stretch && ! i2 . letterbox ? ( n . width = i2 . width * r , n . height = i2 . height * r ) : ( n . width = n . parentElement . offsetWidth , n . height = n . parentElement . offsetHeight ) ;
2022-04-18 01:14:39 +00:00
let u = [ "outline: none" , "cursor: default" ] ;
2022-04-24 09:47:31 +00:00
i2 . crisp && ( u . push ( "image-rendering: pixelated" ) , u . push ( "image-rendering: crisp-edges" ) ) , n . style = u . join ( ";" ) , n . setAttribute ( "tabindex" , "0" ) ;
2022-04-18 01:14:39 +00:00
let c = n . getContext ( "webgl" , { antialias : true , depth : true , stencil : true , alpha : true , preserveDrawingBuffer : true } ) ;
return { canvas : n , scale : r , gl : c , keyStates : { } , mouseStates : { } , charInputted : [ ] , isMouseMoved : false , isKeyPressed : false , isKeyPressedRepeat : false , isKeyReleased : false , mousePos : f ( 0 , 0 ) , mouseDeltaPos : f ( 0 , 0 ) , time : 0 , realTime : 0 , skipTime : false , dt : 0 , numFrames : 0 , isTouch : "ontouchstart" in window || navigator . maxTouchPoints > 0 , loopID : null , stopped : false , paused : false , fpsCounter : new Be ( ) , loaded : false } ;
} ) ( ) , l = ( ( ) => {
var d ;
2022-04-24 09:47:31 +00:00
let e = t . gl , n = cn ( sn , on ) , r = Ke ( new ImageData ( new Uint8ClampedArray ( [ 255 , 255 , 255 , 255 ] ) , 1 , 1 ) ) , u = ( d = i2 . background ) != null ? d : E ( 0 , 0 , 0 ) ;
if ( i2 . background ) {
let h2 = v . fromArray ( i2 . background ) ;
e . clearColor ( h2 . r / 255 , h2 . g / 255 , h2 . b / 255 , 1 ) ;
2022-04-18 01:14:39 +00:00
}
e . enable ( e . BLEND ) , e . enable ( e . SCISSOR _TEST ) , e . blendFuncSeparate ( e . SRC _ALPHA , e . ONE _MINUS _SRC _ALPHA , e . ONE , e . ONE _MINUS _SRC _ALPHA ) ;
let c = e . createBuffer ( ) ;
e . bindBuffer ( e . ARRAY _BUFFER , c ) , e . vertexAttribPointer ( 0 , 3 , e . FLOAT , false , je * 4 , 0 ) , e . enableVertexAttribArray ( 0 ) , e . vertexAttribPointer ( 1 , 2 , e . FLOAT , false , je * 4 , 12 ) , e . enableVertexAttribArray ( 1 ) , e . vertexAttribPointer ( 2 , 4 , e . FLOAT , false , je * 4 , 20 ) , e . enableVertexAttribArray ( 2 ) , e . bufferData ( e . ARRAY _BUFFER , bt * 4 , e . DYNAMIC _DRAW ) , e . bindBuffer ( e . ARRAY _BUFFER , null ) ;
let s = e . createBuffer ( ) ;
e . bindBuffer ( e . ELEMENT _ARRAY _BUFFER , s ) , e . bufferData ( e . ELEMENT _ARRAY _BUFFER , bt * 2 , e . DYNAMIC _DRAW ) , e . bindBuffer ( e . ELEMENT _ARRAY _BUFFER , null ) ;
let o = Ke ( new ImageData ( new Uint8ClampedArray ( [ 128 , 128 , 128 , 255 , 190 , 190 , 190 , 255 , 190 , 190 , 190 , 255 , 128 , 128 , 128 , 255 ] ) , 2 , 2 ) , { wrap : "repeat" , filter : "nearest" } ) ;
2022-04-24 09:47:31 +00:00
return { drawCalls : 0 , lastDrawCalls : 0 , defShader : n , curShader : n , defTex : r , curTex : r , curUniform : { } , vbuf : c , ibuf : s , vqueue : [ ] , iqueue : [ ] , transform : new R ( ) , transformStack : [ ] , bgTex : o , width : i2 . width , height : i2 . height , viewport : { x : 0 , y : 0 , width : e . drawingBufferWidth , height : e . drawingBufferHeight } } ;
2022-04-18 01:14:39 +00:00
} ) ( ) ;
Un ( ) ;
let w = ( ( ) => {
let e = new ( window . AudioContext || window . webkitAudioContext ) ( ) , n = e . createGain ( ) ;
n . connect ( e . destination ) ;
let r = { buf : Gr ( ) } ;
return e . decodeAudioData ( Mr . buffer . slice ( 0 ) , ( u ) => {
r . buf = u ;
} , ( ) => {
throw new Error ( "Failed to load burp." ) ;
} ) , { ctx : e , masterNode : n , burpSnd : r } ;
} ) ( ) , U = { numLoading : 0 , numLoaded : 0 , urlPrefix : "" , sprites : { } , sounds : { } , shaders : { } , fonts : { } } , p = { events : { } , objEvents : { } , root : En ( [ ] ) , timers : new $ ( ) , layers : { } , defLayer : null , gravity : Vr , on ( e , n ) {
return this . events [ e ] || ( this . events [ e ] = new $ ( ) ) , this . events [ e ] . pushd ( n ) ;
} , trigger ( e , ... n ) {
this . events [ e ] && this . events [ e ] . forEach ( ( r ) => r ( ... n ) ) ;
} , scenes : { } , logs : [ ] , cam : { pos : ot ( ) , scale : f ( 1 ) , angle : 0 , shake : 0 , transform : new R ( ) } } ;
function S ( e ) {
return U . numLoading ++ , new Promise ( ( n , r ) => {
e . then ( n ) . catch ( ( u ) => {
C . error ( u ) , r ( u ) ;
} ) . finally ( ( ) => {
U . numLoading -- , U . numLoaded ++ ;
} ) ;
} ) ;
}
_ _name ( S , "S" ) ;
a ( S , "load" ) ;
function A ( ) {
return U . numLoaded / ( U . numLoading + U . numLoaded ) ;
}
_ _name ( A , "A" ) ;
a ( A , "loadProgress" ) ;
function q ( e ) {
return e !== void 0 && ( U . urlPrefix = e ) , U . urlPrefix ;
}
_ _name ( q , "q" ) ;
a ( q , "loadRoot" ) ;
function V ( e ) {
let n = U . urlPrefix + e ;
return fetch ( n ) . then ( ( r ) => {
if ( ! r . ok )
throw new Error ( ` Failed to fetch ${ n } ` ) ;
return r ;
} ) ;
}
_ _name ( V , "V" ) ;
a ( V , "fetchURL" ) ;
function j ( e ) {
let n = new Image ( ) ;
return n . src = cr ( e ) ? e : U . urlPrefix + e , n . crossOrigin = "anonymous" , new Promise ( ( r , u ) => {
n . onload = ( ) => r ( n ) , n . onerror = ( ) => u ( ` Failed to load image from " ${ e } " ` ) ;
} ) ;
}
_ _name ( j , "j" ) ;
a ( j , "loadImg" ) ;
function X ( e , n , r , u , c = { } ) {
return S ( j ( n ) . then ( ( s ) => {
var d ;
let o = Nr ( Ke ( s , c ) , r , u , ( d = c . chars ) != null ? d : Ar ) ;
return e && ( U . fonts [ e ] = o ) , o ;
} ) ) ;
}
_ _name ( X , "X" ) ;
a ( X , "loadFont" ) ;
function Y ( e ) {
var n ;
return ( n = U . sprites [ e ] ) != null ? n : null ;
}
_ _name ( Y , "Y" ) ;
a ( Y , "getSprite" ) ;
function an ( e ) {
var n ;
return ( n = U . sounds [ e ] ) != null ? n : null ;
}
_ _name ( an , "an" ) ;
a ( an , "getSound" ) ;
function xt ( e ) {
var n ;
return ( n = U . fonts [ e ] ) != null ? n : null ;
}
_ _name ( xt , "xt" ) ;
a ( xt , "getFont" ) ;
function vt ( e ) {
var n ;
return ( n = U . shaders [ e ] ) != null ? n : null ;
}
_ _name ( vt , "vt" ) ;
a ( vt , "getShader" ) ;
function ve ( e = 1 , n = 1 , r = 0 , u = 0 , c = 1 , s = 1 ) {
2022-04-24 09:47:31 +00:00
let o = [ ] , d = c / e , h2 = s / n ;
2022-04-18 01:14:39 +00:00
for ( let m = 0 ; m < n ; m ++ )
for ( let g = 0 ; g < e ; g ++ )
2022-04-24 09:47:31 +00:00
o . push ( new k ( r + g * d , u + m * h2 , d , h2 ) ) ;
2022-04-18 01:14:39 +00:00
return o ;
}
_ _name ( ve , "ve" ) ;
a ( ve , "slice" ) ;
function Ee ( e , n ) {
return S ( typeof n == "string" ? V ( n ) . then ( ( r ) => r . json ( ) ) . then ( ( r ) => Ee ( e , r ) ) : J ( null , e ) . then ( ( r ) => {
let u = { } , c = r . tex . width , s = r . tex . height ;
for ( let o in n ) {
2022-04-24 09:47:31 +00:00
let d = n [ o ] , h2 = { tex : r . tex , frames : ve ( d . sliceX , d . sliceY , d . x / c , d . y / s , d . width / c , d . height / s ) , anims : d . anims } ;
U . sprites [ o ] = h2 , u [ o ] = h2 ;
2022-04-18 01:14:39 +00:00
}
return u ;
} ) ) ;
}
_ _name ( Ee , "Ee" ) ;
a ( Ee , "loadSpriteAtlas" ) ;
function Te ( e , n , r = { } ) {
let u = Ke ( n , r ) , c = ve ( r . sliceX || 1 , r . sliceY || 1 ) , s = { tex : u , frames : c , anims : r . anims || { } } ;
return e && ( U . sprites [ e ] = s ) , s ;
}
_ _name ( Te , "Te" ) ;
a ( Te , "loadRawSprite" ) ;
function J ( e , n , r = { sliceX : 1 , sliceY : 1 , anims : { } } ) {
return S ( new Promise ( ( u , c ) => {
if ( ! n )
return c ( ` Expected sprite src for " ${ e } " ` ) ;
typeof n == "string" ? j ( n ) . then ( ( s ) => u ( Te ( e , s , r ) ) ) . catch ( c ) : u ( Te ( e , n , r ) ) ;
} ) ) ;
}
_ _name ( J , "J" ) ;
a ( J , "loadSprite" ) ;
function $e ( e , n ) {
return S ( new Promise ( ( r , u ) => {
V ( n ) . then ( ( c ) => c . json ( ) ) . then ( ( c ) => sr ( this , null , function * ( ) {
let s = yield Promise . all ( c . frames . map ( j ) ) , o = document . createElement ( "canvas" ) ;
o . width = c . width , o . height = c . height * c . frames . length ;
let d = o . getContext ( "2d" ) ;
2022-04-24 09:47:31 +00:00
return s . forEach ( ( h2 , m ) => {
d . drawImage ( h2 , 0 , m * c . height ) ;
2022-04-18 01:14:39 +00:00
} ) , J ( e , o , { sliceY : c . frames . length , anims : c . anims } ) ;
} ) ) . then ( r ) . catch ( u ) ;
} ) ) ;
}
_ _name ( $e , "$e" ) ;
a ( $e , "loadPedit" ) ;
function Et ( e , n , r ) {
return S ( new Promise ( ( u , c ) => {
J ( e , n ) . then ( ( s ) => {
V ( r ) . then ( ( o ) => o . json ( ) ) . then ( ( o ) => {
let d = o . meta . size ;
2022-04-24 09:47:31 +00:00
s . frames = o . frames . map ( ( h2 ) => new k ( h2 . frame . x / d . w , h2 . frame . y / d . h , h2 . frame . w / d . w , h2 . frame . h / d . h ) ) ;
for ( let h2 of o . meta . frameTags )
h2 . from === h2 . to ? s . anims [ h2 . name ] = h2 . from : s . anims [ h2 . name ] = { from : h2 . from , to : h2 . to , speed : 10 , loop : true } ;
2022-04-18 01:14:39 +00:00
u ( s ) ;
} ) . catch ( c ) ;
} ) . catch ( c ) ;
} ) ) ;
}
_ _name ( Et , "Et" ) ;
a ( Et , "loadAseprite" ) ;
function Se ( e , n , r , u = false ) {
function c ( s , o , d ) {
2022-04-24 09:47:31 +00:00
let h2 = cn ( o , d ) ;
return s && ( U . shaders [ s ] = h2 ) , h2 ;
2022-04-18 01:14:39 +00:00
}
_ _name ( c , "c" ) ;
return a ( c , "loadRawShader" ) , S ( new Promise ( ( s , o ) => {
if ( ! n && ! r )
return o ( "no shader" ) ;
2022-04-24 09:47:31 +00:00
function d ( h2 ) {
return h2 ? V ( h2 ) . then ( ( m ) => m . text ( ) ) . catch ( o ) : new Promise ( ( m ) => m ( null ) ) ;
2022-04-18 01:14:39 +00:00
}
_ _name ( d , "d" ) ;
if ( a ( d , "resolveUrl" ) , u )
2022-04-24 09:47:31 +00:00
Promise . all ( [ d ( n ) , d ( r ) ] ) . then ( ( [ h2 , m ] ) => {
s ( c ( e , h2 , m ) ) ;
2022-04-18 01:14:39 +00:00
} ) . catch ( o ) ;
else
try {
s ( c ( e , n , r ) ) ;
2022-04-24 09:47:31 +00:00
} catch ( h2 ) {
o ( h2 ) ;
2022-04-18 01:14:39 +00:00
}
} ) ) ;
}
_ _name ( Se , "Se" ) ;
a ( Se , "loadShader" ) ;
function Ce ( e , n ) {
return S ( new Promise ( ( r , u ) => {
if ( ! n )
return u ( ` expected sound src for " ${ e } " ` ) ;
typeof n == "string" && V ( n ) . then ( ( c ) => c . arrayBuffer ( ) ) . then ( ( c ) => new Promise ( ( s , o ) => w . ctx . decodeAudioData ( c , s , o ) ) ) . then ( ( c ) => {
let s = { buf : c } ;
e && ( U . sounds [ e ] = s ) , r ( s ) ;
} ) . catch ( u ) ;
} ) ) ;
}
_ _name ( Ce , "Ce" ) ;
a ( Ce , "loadSound" ) ;
function _r ( e = "bean" ) {
return J ( e , Wr ) ;
}
_ _name ( _r , "_r" ) ;
a ( _r , "loadBean" ) ;
function Br ( e ) {
return e !== void 0 && ( w . masterNode . gain . value = z ( e , Or , Ir ) ) , w . masterNode . gain . value ;
}
_ _name ( Br , "Br" ) ;
a ( Br , "volume" ) ;
function Xe ( e , n = { loop : false , volume : 1 , speed : 1 , detune : 0 , seek : 0 } ) {
var g ;
if ( typeof e == "string" ) {
let y = Xe ( { buf : Gr ( ) } ) ;
return Ue ( ( ) => {
let x = U . sounds [ e ] ;
if ( ! x )
throw new Error ( ` Sound not found: " ${ e } " ` ) ;
let W = Xe ( x , n ) ;
for ( let O in W )
y [ O ] = W [ O ] ;
} ) , y ;
}
let r = w . ctx , u = false , c = r . createBufferSource ( ) ;
c . buffer = e . buf , c . loop = ! ! n . loop ;
let s = r . createGain ( ) ;
c . connect ( s ) , s . connect ( w . masterNode ) ;
let o = ( g = n . seek ) != null ? g : 0 ;
c . start ( 0 , o ) ;
2022-04-24 09:47:31 +00:00
let d = r . currentTime - o , h2 = null , m = { stop ( ) {
2022-04-18 01:14:39 +00:00
u || ( this . pause ( ) , d = r . currentTime ) ;
} , play ( y ) {
if ( ! u )
return ;
let x = c ;
c = r . createBufferSource ( ) , c . buffer = x . buffer , c . loop = x . loop , c . playbackRate . value = x . playbackRate . value , c . detune && ( c . detune . value = x . detune . value ) , c . connect ( s ) ;
let W = y != null ? y : this . time ( ) ;
2022-04-24 09:47:31 +00:00
c . start ( 0 , W ) , d = r . currentTime - W , u = false , h2 = null ;
2022-04-18 01:14:39 +00:00
} , pause ( ) {
2022-04-24 09:47:31 +00:00
u || ( c . stop ( ) , u = true , h2 = r . currentTime ) ;
2022-04-18 01:14:39 +00:00
} , isPaused ( ) {
return u ;
} , paused ( ) {
return B ( "paused()" , "isPaused()" ) , this . isPaused ( ) ;
} , isStopped ( ) {
return u ;
} , stopped ( ) {
return B ( "stopped()" , "isStopped()" ) , this . isStopped ( ) ;
} , speed ( y ) {
return y !== void 0 && ( c . playbackRate . value = z ( y , ds , fs ) ) , c . playbackRate . value ;
} , detune ( y ) {
return c . detune ? ( y !== void 0 && ( c . detune . value = z ( y , ps , ms ) ) , c . detune . value ) : 0 ;
} , volume ( y ) {
return y !== void 0 && ( s . gain . value = z ( y , Or , Ir ) ) , s . gain . value ;
} , loop ( ) {
c . loop = true ;
} , unloop ( ) {
c . loop = false ;
} , duration ( ) {
return e . buf . duration ;
} , time ( ) {
2022-04-24 09:47:31 +00:00
return u ? h2 - d : r . currentTime - d ;
2022-04-18 01:14:39 +00:00
} } ;
return m . speed ( n . speed ) , m . detune ( n . detune ) , m . volume ( n . volume ) , m ;
}
_ _name ( Xe , "Xe" ) ;
a ( Xe , "play" ) ;
function un ( e ) {
return Xe ( w . burpSnd , e ) ;
}
_ _name ( un , "un" ) ;
a ( un , "burp" ) ;
function Ke ( e , n = { } ) {
let r = t . gl , u = r . createTexture ( ) ;
r . bindTexture ( r . TEXTURE _2D , u ) , r . texImage2D ( r . TEXTURE _2D , 0 , r . RGBA , r . RGBA , r . UNSIGNED _BYTE , e ) ;
let c = ( ( ) => {
var o ;
2022-04-24 09:47:31 +00:00
switch ( ( o = n . filter ) != null ? o : i2 . texFilter ) {
2022-04-18 01:14:39 +00:00
case "linear" :
return r . LINEAR ;
case "nearest" :
return r . NEAREST ;
default :
return r . NEAREST ;
}
} ) ( ) , s = ( ( ) => {
switch ( n . wrap ) {
case "repeat" :
return r . REPEAT ;
case "clampToEdge" :
return r . CLAMP _TO _EDGE ;
default :
return r . CLAMP _TO _EDGE ;
}
} ) ( ) ;
return r . texParameteri ( r . TEXTURE _2D , r . TEXTURE _MIN _FILTER , c ) , r . texParameteri ( r . TEXTURE _2D , r . TEXTURE _MAG _FILTER , c ) , r . texParameteri ( r . TEXTURE _2D , r . TEXTURE _WRAP _S , s ) , r . texParameteri ( r . TEXTURE _2D , r . TEXTURE _WRAP _T , s ) , r . bindTexture ( r . TEXTURE _2D , null ) , { width : e . width , height : e . height , bind ( ) {
r . bindTexture ( r . TEXTURE _2D , u ) ;
} , unbind ( ) {
r . bindTexture ( r . TEXTURE _2D , null ) ;
} } ;
}
_ _name ( Ke , "Ke" ) ;
a ( Ke , "makeTex" ) ;
function cn ( e = sn , n = on ) {
let r = t . gl , u , c = gs . replace ( "{{user}}" , e != null ? e : sn ) , s = Us . replace ( "{{user}}" , n != null ? n : on ) , o = r . createShader ( r . VERTEX _SHADER ) , d = r . createShader ( r . FRAGMENT _SHADER ) ;
if ( r . shaderSource ( o , c ) , r . shaderSource ( d , s ) , r . compileShader ( o ) , r . compileShader ( d ) , u = r . getShaderInfoLog ( o ) )
throw new Error ( u ) ;
if ( u = r . getShaderInfoLog ( d ) )
throw new Error ( u ) ;
2022-04-24 09:47:31 +00:00
let h2 = r . createProgram ( ) ;
if ( r . attachShader ( h2 , o ) , r . attachShader ( h2 , d ) , r . bindAttribLocation ( h2 , 0 , "a_pos" ) , r . bindAttribLocation ( h2 , 1 , "a_uv" ) , r . bindAttribLocation ( h2 , 2 , "a_color" ) , r . linkProgram ( h2 ) , ( u = r . getProgramInfoLog ( h2 ) ) && u !== `
2022-04-18 01:14:39 +00:00
` )
throw new Error ( u ) ;
return { bind ( ) {
2022-04-24 09:47:31 +00:00
r . useProgram ( h2 ) ;
2022-04-18 01:14:39 +00:00
} , unbind ( ) {
r . useProgram ( null ) ;
} , send ( m ) {
this . bind ( ) ;
for ( let g in m ) {
2022-04-24 09:47:31 +00:00
let y = m [ g ] , x = r . getUniformLocation ( h2 , g ) ;
2022-04-18 01:14:39 +00:00
typeof y == "number" ? r . uniform1f ( x , y ) : y instanceof R ? r . uniformMatrix4fv ( x , false , new Float32Array ( y . m ) ) : y instanceof v ? r . uniform4f ( x , y . r , y . g , y . b , y . a ) : y instanceof Fe ? r . uniform3f ( x , y . x , y . y , y . z ) : y instanceof L && r . uniform2f ( x , y . x , y . y ) ;
}
this . unbind ( ) ;
} } ;
}
_ _name ( cn , "cn" ) ;
a ( cn , "makeShader" ) ;
function Nr ( e , n , r , u ) {
2022-04-24 09:47:31 +00:00
let c = e . width / n , s = e . height / r , o = 1 / c , d = 1 / s , h2 = { } , m = u . split ( "" ) . entries ( ) ;
2022-04-18 01:14:39 +00:00
for ( let [ g , y ] of m )
2022-04-24 09:47:31 +00:00
h2 [ y ] = f ( g % c * o , Math . floor ( g / c ) * d ) ;
return { tex : e , map : h2 , qw : o , qh : d } ;
2022-04-18 01:14:39 +00:00
}
_ _name ( Nr , "Nr" ) ;
a ( Nr , "makeFont" ) ;
function Tt ( e , n , r , u = l . defTex , c = l . defShader , s = { } ) {
u = u != null ? u : l . defTex , c = c != null ? c : l . defShader , ( u !== l . curTex || c !== l . curShader || ! jt ( l . curUniform , s ) || l . vqueue . length + e . length * je > bt || l . iqueue . length + n . length > bt ) && ln ( ) ;
for ( let o of e ) {
2022-04-24 09:47:31 +00:00
let d = r ? l . transform : p . cam . transform . mult ( l . transform ) , h2 = jr ( d . multVec2 ( o . pos . xy ( ) ) ) ;
l . vqueue . push ( h2 . x , h2 . y , o . pos . z , o . uv . x , o . uv . y , o . color . r / 255 , o . color . g / 255 , o . color . b / 255 , o . opacity ) ;
2022-04-18 01:14:39 +00:00
}
for ( let o of n )
l . iqueue . push ( o + l . vqueue . length / je - e . length ) ;
l . curTex = u , l . curShader = c , l . curUniform = s ;
}
_ _name ( Tt , "Tt" ) ;
a ( Tt , "drawRaw" ) ;
function ln ( ) {
if ( ! l . curTex || ! l . curShader || l . vqueue . length === 0 || l . iqueue . length === 0 )
return ;
let e = t . gl ;
l . curShader . send ( l . curUniform ) , e . bindBuffer ( e . ARRAY _BUFFER , l . vbuf ) , e . bufferSubData ( e . ARRAY _BUFFER , 0 , new Float32Array ( l . vqueue ) ) , e . bindBuffer ( e . ELEMENT _ARRAY _BUFFER , l . ibuf ) , e . bufferSubData ( e . ELEMENT _ARRAY _BUFFER , 0 , new Uint16Array ( l . iqueue ) ) , l . curShader . bind ( ) , l . curTex . bind ( ) , e . drawElements ( e . TRIANGLES , l . iqueue . length , e . UNSIGNED _SHORT , 0 ) , l . curTex . unbind ( ) , l . curShader . unbind ( ) , e . bindBuffer ( e . ARRAY _BUFFER , null ) , e . bindBuffer ( e . ELEMENT _ARRAY _BUFFER , null ) , l . iqueue = [ ] , l . vqueue = [ ] , l . drawCalls ++ ;
}
_ _name ( ln , "ln" ) ;
a ( ln , "flush" ) ;
function He ( ) {
2022-04-24 09:47:31 +00:00
t . gl . clear ( t . gl . COLOR _BUFFER _BIT ) , i2 . background || pe ( { width : F ( ) , height : G ( ) , quad : new k ( 0 , 0 , F ( ) * t . scale / Fr , G ( ) * t . scale / Fr ) , tex : l . bgTex , fixed : true } ) , l . drawCalls = 0 , l . transformStack = [ ] , l . transform = new R ( ) ;
2022-04-18 01:14:39 +00:00
}
_ _name ( He , "He" ) ;
a ( He , "frameStart" ) ;
function ze ( ) {
ln ( ) , l . lastDrawCalls = l . drawCalls ;
}
_ _name ( ze , "ze" ) ;
a ( ze , "frameEnd" ) ;
function Ts ( ) {
return l . lastDrawCalls ;
}
_ _name ( Ts , "Ts" ) ;
a ( Ts , "drawCalls" ) ;
function jr ( e ) {
return f ( e . x / F ( ) * 2 - 1 , - e . y / G ( ) * 2 + 1 ) ;
}
_ _name ( jr , "jr" ) ;
a ( jr , "screen2ndc" ) ;
function Ss ( e ) {
return f ( ( e . x + 1 ) / 2 * F ( ) , - ( e . y - 1 ) / 2 * G ( ) ) ;
}
_ _name ( Ss , "Ss" ) ;
a ( Ss , "ndc2screen" ) ;
function Cs ( e ) {
l . transform = e . clone ( ) ;
}
_ _name ( Cs , "Cs" ) ;
a ( Cs , "applyMatrix" ) ;
function I ( ... e ) {
if ( e [ 0 ] === void 0 )
return ;
let n = f ( ... e ) ;
n . x === 0 && n . y === 0 || ( l . transform = l . transform . translate ( n ) ) ;
}
_ _name ( I , "I" ) ;
a ( I , "pushTranslate" ) ;
function ne ( ... e ) {
if ( e [ 0 ] === void 0 )
return ;
let n = f ( ... e ) ;
n . x === 1 && n . y === 1 || ( l . transform = l . transform . scale ( n ) ) ;
}
_ _name ( ne , "ne" ) ;
a ( ne , "pushScale" ) ;
function Rs ( e ) {
! e || ( l . transform = l . transform . rotateX ( e ) ) ;
}
_ _name ( Rs , "Rs" ) ;
a ( Rs , "pushRotateX" ) ;
function Ws ( e ) {
! e || ( l . transform = l . transform . rotateY ( e ) ) ;
}
_ _name ( Ws , "Ws" ) ;
a ( Ws , "pushRotateY" ) ;
function Je ( e ) {
! e || ( l . transform = l . transform . rotateZ ( e ) ) ;
}
_ _name ( Je , "Je" ) ;
a ( Je , "pushRotateZ" ) ;
function re ( ) {
l . transformStack . push ( l . transform . clone ( ) ) ;
}
_ _name ( re , "re" ) ;
a ( re , "pushTransform" ) ;
function ie ( ) {
l . transformStack . length > 0 && ( l . transform = l . transformStack . pop ( ) ) ;
}
_ _name ( ie , "ie" ) ;
a ( ie , "popTransform" ) ;
function pe ( e ) {
2022-04-24 09:47:31 +00:00
var h2 ;
2022-04-18 01:14:39 +00:00
if ( e . width === void 0 || e . height === void 0 )
throw new Error ( 'drawUVQuad() requires property "width" and "height".' ) ;
if ( e . width <= 0 || e . height <= 0 )
return ;
2022-04-24 09:47:31 +00:00
let n = e . width , r = e . height , c = Ye ( e . origin || Ne ) . scale ( f ( n , r ) . scale ( - 0.5 ) ) , s = e . quad || new k ( 0 , 0 , 1 , 1 ) , o = e . color || E ( 255 , 255 , 255 ) , d = ( h2 = e . opacity ) != null ? h2 : 1 ;
2022-04-18 01:14:39 +00:00
re ( ) , I ( e . pos ) , Je ( e . angle ) , ne ( e . scale ) , I ( c ) , Tt ( [ { pos : de ( - n / 2 , r / 2 , 0 ) , uv : f ( e . flipX ? s . x + s . w : s . x , e . flipY ? s . y : s . y + s . h ) , color : o , opacity : d } , { pos : de ( - n / 2 , - r / 2 , 0 ) , uv : f ( e . flipX ? s . x + s . w : s . x , e . flipY ? s . y + s . h : s . y ) , color : o , opacity : d } , { pos : de ( n / 2 , - r / 2 , 0 ) , uv : f ( e . flipX ? s . x : s . x + s . w , e . flipY ? s . y + s . h : s . y ) , color : o , opacity : d } , { pos : de ( n / 2 , r / 2 , 0 ) , uv : f ( e . flipX ? s . x : s . x + s . w , e . flipY ? s . y : s . y + s . h ) , color : o , opacity : d } ] , [ 0 , 1 , 3 , 1 , 2 , 3 ] , e . fixed , e . tex , e . shader , e . uniform ) , ie ( ) ;
}
_ _name ( pe , "pe" ) ;
a ( pe , "drawUVQuad" ) ;
function Yr ( e ) {
var s ;
if ( ! e . tex )
throw new Error ( 'drawTexture() requires property "tex".' ) ;
let n = ( s = e . quad ) != null ? s : new k ( 0 , 0 , 1 , 1 ) , r = e . tex . width * n . w , u = e . tex . height * n . h , c = f ( 1 ) ;
if ( e . tiled ) {
let o = Math . ceil ( ( e . width || r ) / r ) , d = Math . ceil ( ( e . height || u ) / u ) , m = Ye ( e . origin || Ne ) . add ( f ( 1 , 1 ) ) . scale ( 0.5 ) . scale ( o * r , d * u ) ;
for ( let g = 0 ; g < o ; g ++ )
for ( let y = 0 ; y < d ; y ++ )
pe ( D ( P ( { } , e ) , { pos : ( e . pos || f ( 0 ) ) . add ( f ( r * g , u * y ) ) . sub ( m ) , scale : c . scale ( e . scale || f ( 1 ) ) , tex : e . tex , quad : n , width : r , height : u , origin : "topleft" } ) ) ;
} else
e . width && e . height ? ( c . x = e . width / r , c . y = e . height / u ) : e . width ? ( c . x = e . width / r , c . y = c . x ) : e . height && ( c . y = e . height / u , c . x = c . y ) , pe ( D ( P ( { } , e ) , { scale : c . scale ( e . scale || f ( 1 ) ) , tex : e . tex , quad : n , width : r , height : u } ) ) ;
}
_ _name ( Yr , "Yr" ) ;
a ( Yr , "drawTexture" ) ;
let St = /* @__PURE__ */ new Set ( ) ;
function hn ( e ) {
var u , c ;
if ( ! e . sprite )
throw new Error ( 'drawSprite() requires property "sprite"' ) ;
let n = gn ( e . sprite , U . sprites ) ;
if ( ! n )
if ( typeof e . sprite == "string" ) {
St . has ( e . sprite ) || ( St . add ( e . sprite ) , J ( e . sprite , e . sprite ) . then ( ( s ) => St . delete ( e . sprite ) ) ) ;
return ;
} else
throw new Error ( ` sprite not found: " ${ e . sprite } " ` ) ;
let r = n . frames [ ( u = e . frame ) != null ? u : 0 ] ;
if ( ! r )
throw new Error ( ` frame not found: ${ ( c = e . frame ) != null ? c : 0 } ` ) ;
Yr ( D ( P ( { } , e ) , { tex : n . tex , quad : r . scale ( e . quad || new k ( 0 , 0 , 1 , 1 ) ) , uniform : e . uniform } ) ) ;
}
_ _name ( hn , "hn" ) ;
a ( hn , "drawSprite" ) ;
function Re ( e , n , r , u , c , s = 1 ) {
u = he ( u % 360 ) , c = he ( c % 360 ) , c <= u && ( c += Math . PI * 2 ) ;
2022-04-24 09:47:31 +00:00
let o = Math . ceil ( Math . max ( Math . sqrt ( n + r ) * 3 * ( s || 1 ) , 16 ) ) , d = ( c - u ) / o , h2 = [ ] ;
2022-04-18 01:14:39 +00:00
for ( let m = u ; m < c ; m += d )
2022-04-24 09:47:31 +00:00
h2 . push ( e . add ( n * Math . cos ( m ) , r * Math . sin ( m ) ) ) ;
return h2 . push ( e . add ( n * Math . cos ( c ) , r * Math . sin ( c ) ) ) , h2 ;
2022-04-18 01:14:39 +00:00
}
_ _name ( Re , "Re" ) ;
a ( Re , "getArcPts" ) ;
function Q ( e ) {
if ( e . width === void 0 || e . height === void 0 )
throw new Error ( 'drawRect() requires property "width" and "height".' ) ;
if ( e . width <= 0 || e . height <= 0 )
return ;
let n = e . width , r = e . height , c = Ye ( e . origin || Ne ) . add ( 1 , 1 ) . scale ( f ( n , r ) . scale ( - 0.5 ) ) , s = [ f ( 0 , 0 ) , f ( n , 0 ) , f ( n , r ) , f ( 0 , r ) ] ;
if ( e . radius ) {
let o = Math . min ( Math . min ( n , r ) / 2 , e . radius ) ;
s = [ f ( o , 0 ) , f ( n - o , 0 ) , ... Re ( f ( n - o , o ) , o , o , 270 , 360 ) , f ( n , o ) , f ( n , r - o ) , ... Re ( f ( n - o , r - o ) , o , o , 0 , 90 ) , f ( n - o , r ) , f ( o , r ) , ... Re ( f ( o , r - o ) , o , o , 90 , 180 ) , f ( 0 , r - o ) , f ( 0 , o ) , ... Re ( f ( o , o ) , o , o , 180 , 270 ) ] ;
}
Qe ( D ( P ( { } , e ) , { offset : c , pts : s } ) ) ;
}
_ _name ( Q , "Q" ) ;
a ( Q , "drawRect" ) ;
function We ( e ) {
let { p1 : n , p2 : r } = e ;
if ( ! n || ! r )
throw new Error ( 'drawLine() requires properties "p1" and "p2".' ) ;
let u = e . width || 1 , c = r . sub ( n ) . unit ( ) . normal ( ) . scale ( u * 0.5 ) , s = [ n . sub ( c ) , n . add ( c ) , r . add ( c ) , r . sub ( c ) ] . map ( ( o ) => {
2022-04-24 09:47:31 +00:00
var d , h2 ;
return { pos : de ( o . x , o . y , 0 ) , uv : f ( 0 ) , color : ( d = e . color ) != null ? d : v . WHITE , opacity : ( h2 = e . opacity ) != null ? h2 : 1 } ;
2022-04-18 01:14:39 +00:00
} ) ;
Tt ( s , [ 0 , 1 , 3 , 1 , 2 , 3 ] , e . fixed , l . defTex , e . shader , e . uniform ) ;
}
_ _name ( We , "We" ) ;
a ( We , "drawLine" ) ;
function dn ( e ) {
let n = e . pts ;
if ( ! n )
throw new Error ( 'drawLines() requires property "pts".' ) ;
if ( ! ( n . length < 2 ) )
if ( e . radius && n . length >= 3 ) {
let r = n [ 0 ] . dist ( n [ 1 ] ) ;
for ( let c = 1 ; c < n . length - 1 ; c ++ )
r = Math . min ( n [ c ] . dist ( n [ c + 1 ] ) , r ) ;
let u = Math . min ( e . radius , r / 2 ) ;
We ( D ( P ( { } , e ) , { p1 : n [ 0 ] , p2 : n [ 1 ] } ) ) ;
for ( let c = 1 ; c < n . length - 2 ; c ++ ) {
let s = n [ c ] , o = n [ c + 1 ] ;
We ( D ( P ( { } , e ) , { p1 : s , p2 : o } ) ) ;
}
We ( D ( P ( { } , e ) , { p1 : n [ n . length - 2 ] , p2 : n [ n . length - 1 ] } ) ) ;
} else
for ( let r = 0 ; r < n . length - 1 ; r ++ )
We ( D ( P ( { } , e ) , { p1 : n [ r ] , p2 : n [ r + 1 ] } ) ) ;
}
_ _name ( dn , "dn" ) ;
a ( dn , "drawLines" ) ;
function fn ( e ) {
if ( ! e . p1 || ! e . p2 || ! e . p3 )
throw new Error ( 'drawPolygon() requires properties "p1", "p2" and "p3".' ) ;
return Qe ( D ( P ( { } , e ) , { pts : [ e . p1 , e . p2 , e . p3 ] } ) ) ;
}
_ _name ( fn , "fn" ) ;
a ( fn , "drawTriangle" ) ;
function Ct ( e ) {
if ( ! e . radius )
throw new Error ( 'drawCircle() requires property "radius".' ) ;
e . radius !== 0 && pn ( D ( P ( { } , e ) , { radiusX : e . radius , radiusY : e . radius , angle : 0 } ) ) ;
}
_ _name ( Ct , "Ct" ) ;
a ( Ct , "drawCircle" ) ;
function pn ( e ) {
var n , r ;
if ( e . radiusX === void 0 || e . radiusY === void 0 )
throw new Error ( 'drawEllipse() requires properties "radiusX" and "radiusY".' ) ;
e . radiusX === 0 || e . radiusY === 0 || Qe ( D ( P ( { } , e ) , { pts : Re ( f ( 0 ) , e . radiusX , e . radiusY , ( n = e . start ) != null ? n : 0 , ( r = e . end ) != null ? r : 360 , e . resolution ) , radius : 0 } ) ) ;
}
_ _name ( pn , "pn" ) ;
a ( pn , "drawEllipse" ) ;
function Qe ( e ) {
var r , u ;
if ( ! e . pts )
throw new Error ( 'drawPolygon() requires property "pts".' ) ;
let n = e . pts . length ;
if ( ! ( n < 3 ) ) {
if ( re ( ) , I ( e . pos ) , ne ( e . scale ) , Je ( e . angle ) , I ( e . offset ) , e . fill !== false ) {
let c = ( r = e . color ) != null ? r : v . WHITE , s = e . pts . map ( ( d ) => {
2022-04-24 09:47:31 +00:00
var h2 ;
return { pos : de ( d . x , d . y , 0 ) , uv : f ( 0 , 0 ) , color : c , opacity : ( h2 = e . opacity ) != null ? h2 : 1 } ;
2022-04-18 01:14:39 +00:00
} ) , o = [ ... Array ( n - 2 ) . keys ( ) ] . map ( ( d ) => [ 0 , d + 1 , d + 2 ] ) . flat ( ) ;
Tt ( s , ( u = e . indices ) != null ? u : o , e . fixed , l . defTex , e . shader , e . uniform ) ;
}
e . outline && dn ( { pts : [ ... e . pts , e . pts [ 0 ] ] , radius : e . radius , width : e . outline . width , color : e . outline . color , uniform : e . uniform , fixed : e . fixed } ) , ie ( ) ;
}
}
_ _name ( Qe , "Qe" ) ;
a ( Qe , "drawPolygon" ) ;
function mn ( e , n ) {
n . pos && ( e . pos = e . pos . add ( n . pos ) ) , n . scale && ( e . scale = e . scale . scale ( f ( n . scale ) ) ) , n . angle && ( e . angle += n . angle ) , n . color && ( e . color = e . color . mult ( n . color ) ) , n . opacity && ( e . opacity *= n . opacity ) ;
}
_ _name ( mn , "mn" ) ;
a ( mn , "applyCharTransform" ) ;
let wn = /\[(?<text>[^\]]*)\]\.(?<style>[\w\.]+)+/g ;
function $r ( e ) {
let n = { } , r = e . replace ( wn , "$1" ) , u = 0 ;
for ( let c of e . matchAll ( wn ) ) {
let s = c . groups . style . split ( "." ) , o = c . index - u ;
for ( let d = o ; d < c . index + c . groups . text . length ; d ++ )
n [ d ] = { localIdx : d - o , styles : s } ;
u += 3 + c . groups . style . length ;
}
return { charStyleMap : n , text : r } ;
}
_ _name ( $r , "$r" ) ;
a ( $r , "compileStyledText" ) ;
function gn ( e , n , r ) {
if ( e )
return typeof e == "string" ? n [ e ] : e ;
if ( r )
return n [ r ] ;
}
_ _name ( gn , "gn" ) ;
a ( gn , "findAsset" ) ;
function me ( e ) {
var Qn , Zn , er ;
if ( e . text === void 0 )
throw new Error ( 'formatText() requires property "text".' ) ;
2022-04-24 09:47:31 +00:00
let n = gn ( ( Qn = e . font ) != null ? Qn : i2 . font , U . fonts , ws ) ;
2022-04-18 01:14:39 +00:00
if ( ! n )
throw new Error ( ` Font not found: ${ e . font } ` ) ;
2022-04-24 09:47:31 +00:00
let { charStyleMap : r , text : u } = $r ( e . text + "" ) , c = u . split ( "" ) , s = n . qw * n . tex . width , o = n . qh * n . tex . height , d = e . size || o , h2 = f ( d / o ) . scale ( f ( e . scale || 1 ) ) , m = h2 . x * s + ( ( Zn = e . letterSpacing ) != null ? Zn : 0 ) , g = h2 . y * o + ( ( er = e . lineSpacing ) != null ? er : 0 ) , y = 0 , x = g , W = 0 , O = [ ] , M = [ ] , ee = null , te = 0 ;
2022-04-18 01:14:39 +00:00
for ( ; te < c . length ; ) {
let oe = c [ te ] ;
oe === `
` ? (x += g, y = 0, ee = null, M.push(oe), O.push(M), M = []) : (e.width ? y + m > e.width : false) && (x += g, y = 0, ee != null && (te -= M.length - ee, oe = c[te], M = M.slice(0, ee)), ee = null, O.push(M), M = []), oe !== `
` && (M.push(oe), y += m, oe === " " && (ee = M.length)), W = Math.max(W, y), te++;
}
O . push ( M ) , e . width && ( W = e . width ) ;
let Ae = [ ] , Oe = f ( e . pos || 0 ) , _ = Ye ( e . origin || Ne ) . scale ( 0.5 ) , se = - _ . x * m - ( _ . x + 0.5 ) * ( W - m ) , Ie = - _ . y * g - ( _ . y + 0.5 ) * ( x - g ) , ut = 0 ;
return O . forEach ( ( oe , Bi ) => {
let Ni = ( W - oe . length * m ) * ( _ . x + 0.5 ) ;
oe . forEach ( ( ct , ji ) => {
var tr ;
let Gt = n . map [ ct ] , Yi = ji * m , $i = Bi * g ;
if ( Gt ) {
2022-04-24 09:47:31 +00:00
let _t = { tex : n . tex , quad : new k ( Gt . x , Gt . y , n . qw , n . qh ) , ch : ct , pos : f ( Oe . x + Yi + se + Ni , Oe . y + $i + Ie ) , opacity : e . opacity , color : ( tr = e . color ) != null ? tr : E ( 255 , 255 , 255 ) , scale : h2 , angle : 0 , uniform : e . uniform , fixed : e . fixed } ;
2022-04-18 01:14:39 +00:00
if ( e . transform ) {
let lt = typeof e . transform == "function" ? e . transform ( ut , ct ) : e . transform ;
lt && mn ( _t , lt ) ;
}
if ( r [ ut ] ) {
let { styles : lt , localIdx : Xi } = r [ ut ] ;
for ( let Ki of lt ) {
let Bt = e . styles [ Ki ] , nr = typeof Bt == "function" ? Bt ( Xi , ct ) : Bt ;
nr && mn ( _t , nr ) ;
}
}
Ae . push ( _t ) ;
}
ut += 1 ;
} ) ;
} ) , { width : W , height : x , chars : Ae } ;
}
_ _name ( me , "me" ) ;
a ( me , "formatText" ) ;
function Xr ( e ) {
we ( me ( e ) ) ;
}
_ _name ( Xr , "Xr" ) ;
a ( Xr , "drawText" ) ;
function we ( e ) {
for ( let n of e . chars )
pe ( { tex : n . tex , width : n . tex . width * n . quad . w , height : n . tex . height * n . quad . h , pos : n . pos , scale : n . scale , angle : n . angle , color : n . color , opacity : n . opacity , quad : n . quad , origin : "center" , uniform : n . uniform , fixed : n . fixed } ) ;
}
_ _name ( we , "we" ) ;
a ( we , "drawFormattedText" ) ;
function Un ( ) {
let e = t . gl , n = e . drawingBufferWidth , r = e . drawingBufferHeight , u = F ( ) , c = G ( ) ;
if ( vn ( ) ) {
2022-04-24 09:47:31 +00:00
let s = window . innerWidth , o = window . innerHeight , d = s / o , h2 = n / r ;
if ( d > h2 ) {
let m = window . innerHeight * h2 ;
2022-04-18 01:14:39 +00:00
l . viewport = { x : ( s - m ) / 2 , y : 0 , width : m , height : o } ;
} else {
2022-04-24 09:47:31 +00:00
let m = window . innerWidth / h2 ;
2022-04-18 01:14:39 +00:00
l . viewport = { x : 0 , y : ( o - m ) / 2 , width : s , height : m } ;
}
return ;
}
2022-04-24 09:47:31 +00:00
if ( i2 . letterbox ) {
if ( ! i2 . width || ! i2 . height )
2022-04-18 01:14:39 +00:00
throw new Error ( "Letterboxing requires width and height defined." ) ;
2022-04-24 09:47:31 +00:00
let s = n / r , o = i2 . width / i2 . height ;
2022-04-18 01:14:39 +00:00
if ( s > o ) {
2022-04-24 09:47:31 +00:00
i2 . stretch || ( l . width = r * o , l . height = r ) ;
let d = r * o , h2 = r , m = ( n - d ) / 2 ;
e . scissor ( m , 0 , d , h2 ) , e . viewport ( m , 0 , d , r ) , l . viewport = { x : m , y : 0 , width : d , height : r } ;
2022-04-18 01:14:39 +00:00
} else {
2022-04-24 09:47:31 +00:00
i2 . stretch || ( l . width = n , l . height = n / o ) ;
let d = n , h2 = n / o , m = ( r - h2 ) / 2 ;
e . scissor ( 0 , m , d , h2 ) , e . viewport ( 0 , m , n , h2 ) , l . viewport = { x : 0 , y : m , width : n , height : h2 } ;
2022-04-18 01:14:39 +00:00
}
return ;
}
2022-04-24 09:47:31 +00:00
if ( i2 . stretch ) {
if ( ! i2 . width || ! i2 . height )
2022-04-18 01:14:39 +00:00
throw new Error ( "Stretching requires width and height defined." ) ;
e . viewport ( 0 , 0 , n , r ) , l . viewport = { x : 0 , y : 0 , width : n , height : r } ;
return ;
}
l . width = n / t . scale , l . height = r / t . scale , e . viewport ( 0 , 0 , n , r ) , l . viewport = { x : 0 , y : 0 , width : n , height : r } ;
}
_ _name ( Un , "Un" ) ;
a ( Un , "updateViewport" ) ;
function F ( ) {
return l . width ;
}
_ _name ( F , "F" ) ;
a ( F , "width" ) ;
function G ( ) {
return l . height ;
}
_ _name ( G , "G" ) ;
a ( G , "height" ) , t . canvas . addEventListener ( "mousemove" , ( e ) => {
t . mousePos = f ( ( e . offsetX - l . viewport . x ) * F ( ) / l . viewport . width , ( e . offsetY - l . viewport . y ) * G ( ) / l . viewport . height ) , t . mouseDeltaPos = f ( e . movementX , e . movementY ) . scale ( 1 / t . scale ) , t . isMouseMoved = true ;
} ) , t . canvas . addEventListener ( "mousedown" , ( e ) => {
let n = Dr [ e . button ] ;
n && ( t . mouseStates [ n ] = "pressed" ) ;
} ) , t . canvas . addEventListener ( "mouseup" , ( e ) => {
let n = Dr [ e . button ] ;
n && ( t . mouseStates [ n ] = "released" ) ;
} ) , t . canvas . addEventListener ( "keydown" , ( e ) => {
let n = Pr [ e . key ] || e . key . toLowerCase ( ) ;
ls . includes ( n ) && e . preventDefault ( ) , n . length === 1 && t . charInputted . push ( e . key ) , n === "space" && t . charInputted . push ( " " ) , e . repeat ? ( t . isKeyPressedRepeat = true , t . keyStates [ n ] = "rpressed" ) : ( t . isKeyPressed = true , t . keyStates [ n ] = "pressed" ) ;
} ) , t . canvas . addEventListener ( "keyup" , ( e ) => {
let n = Pr [ e . key ] || e . key . toLowerCase ( ) ;
t . keyStates [ n ] = "released" , t . isKeyReleased = true ;
} ) , t . canvas . addEventListener ( "touchstart" , ( e ) => {
2022-04-24 09:47:31 +00:00
if ( ! i2 . touchToMouse )
2022-04-18 01:14:39 +00:00
return ;
e . preventDefault ( ) ;
let n = e . touches [ 0 ] ;
t . mousePos = f ( n . clientX , n . clientY ) . scale ( 1 / t . scale ) , t . mouseStates . left = "pressed" ;
} ) , t . canvas . addEventListener ( "touchmove" , ( e ) => {
2022-04-24 09:47:31 +00:00
if ( ! i2 . touchToMouse )
2022-04-18 01:14:39 +00:00
return ;
e . preventDefault ( ) ;
let n = e . touches [ 0 ] ;
t . mousePos = f ( n . clientX , n . clientY ) . scale ( 1 / t . scale ) , t . isMouseMoved = true ;
} ) , t . canvas . addEventListener ( "touchend" , ( e ) => {
2022-04-24 09:47:31 +00:00
! i2 . touchToMouse || ( t . mouseStates . left = "released" ) ;
2022-04-18 01:14:39 +00:00
} ) , t . canvas . addEventListener ( "touchcancel" , ( e ) => {
2022-04-24 09:47:31 +00:00
! i2 . touchToMouse || ( t . mouseStates . left = "released" ) ;
2022-04-18 01:14:39 +00:00
} ) , t . canvas . addEventListener ( "touchstart" , ( e ) => {
[ ... e . changedTouches ] . forEach ( ( n ) => {
p . trigger ( "onTouchStart" , n . identifier , f ( n . clientX , n . clientY ) . scale ( 1 / t . scale ) ) ;
} ) ;
} ) , t . canvas . addEventListener ( "touchmove" , ( e ) => {
[ ... e . changedTouches ] . forEach ( ( n ) => {
p . trigger ( "onTouchMove" , n . identifier , f ( n . clientX , n . clientY ) . scale ( 1 / t . scale ) ) ;
} ) ;
} ) , t . canvas . addEventListener ( "touchend" , ( e ) => {
[ ... e . changedTouches ] . forEach ( ( n ) => {
p . trigger ( "onTouchEnd" , n . identifier , f ( n . clientX , n . clientY ) . scale ( 1 / t . scale ) ) ;
} ) ;
} ) , t . canvas . addEventListener ( "contextmenu" , function ( e ) {
e . preventDefault ( ) ;
} ) , document . addEventListener ( "visibilitychange" , ( ) => {
switch ( document . visibilityState ) {
case "visible" :
t . skipTime = true , w . ctx . resume ( ) ;
break ;
case "hidden" :
w . ctx . suspend ( ) ;
break ;
}
} ) ;
function K ( ) {
return t . mousePos . clone ( ) ;
}
_ _name ( K , "K" ) ;
a ( K , "mousePos" ) ;
function yn ( ) {
return t . mouseDeltaPos . clone ( ) ;
}
_ _name ( yn , "yn" ) ;
a ( yn , "mouseDeltaPos" ) ;
function Me ( e = "left" ) {
return t . mouseStates [ e ] === "pressed" ;
}
_ _name ( Me , "Me" ) ;
a ( Me , "isMousePressed" ) ;
function Ze ( e = "left" ) {
return t . mouseStates [ e ] === "pressed" || t . mouseStates [ e ] === "down" ;
}
_ _name ( Ze , "Ze" ) ;
a ( Ze , "isMouseDown" ) ;
function et ( e = "left" ) {
return t . mouseStates [ e ] === "released" ;
}
_ _name ( et , "et" ) ;
a ( et , "isMouseReleased" ) ;
function Rt ( ) {
return t . isMouseMoved ;
}
_ _name ( Rt , "Rt" ) ;
a ( Rt , "isMouseMoved" ) ;
function Le ( e ) {
return e === void 0 ? t . isKeyPressed : t . keyStates [ e ] === "pressed" ;
}
_ _name ( Le , "Le" ) ;
a ( Le , "isKeyPressed" ) ;
function Wt ( e ) {
return e === void 0 ? t . isKeyPressedRepeat : t . keyStates [ e ] === "pressed" || t . keyStates [ e ] === "rpressed" ;
}
_ _name ( Wt , "Wt" ) ;
a ( Wt , "isKeyPressedRepeat" ) ;
function Mt ( e ) {
return t . keyStates [ e ] === "pressed" || t . keyStates [ e ] === "rpressed" || t . keyStates [ e ] === "down" ;
}
_ _name ( Mt , "Mt" ) ;
a ( Mt , "isKeyDown" ) ;
function tt ( e ) {
return e === void 0 ? t . isKeyReleased : t . keyStates [ e ] === "released" ;
}
_ _name ( tt , "tt" ) ;
a ( tt , "isKeyReleased" ) ;
function Kr ( ) {
return [ ... t . charInputted ] ;
}
_ _name ( Kr , "Kr" ) ;
a ( Kr , "charInputted" ) ;
function nt ( ) {
return t . time ;
}
_ _name ( nt , "nt" ) ;
a ( nt , "time" ) ;
function bn ( ) {
return t . canvas . toDataURL ( ) ;
}
_ _name ( bn , "bn" ) ;
a ( bn , "screenshot" ) ;
function xn ( e ) {
return e && ( t . canvas . style . cursor = e ) , t . canvas . style . cursor ;
}
_ _name ( xn , "xn" ) ;
a ( xn , "cursor" ) ;
function Hr ( e = true ) {
e ? xs ( t . canvas ) : vs ( ) ;
}
_ _name ( Hr , "Hr" ) ;
a ( Hr , "fullscreen" ) ;
function vn ( ) {
return Boolean ( Es ( ) ) ;
}
_ _name ( vn , "vn" ) ;
a ( vn , "isFullscreen" ) ;
function zr ( ) {
cancelAnimationFrame ( t . loopID ) , t . stopped = true ;
}
_ _name ( zr , "zr" ) ;
a ( zr , "quit" ) ;
let C = { inspect : false , timeScale : 1 , showLog : true , fps : ( ) => t . fpsCounter . fps , objCount ( ) {
return p . root . children . length ;
} , stepFrame : Kn , drawCalls : ( ) => l . drawCalls , clearLog : ( ) => p . logs = [ ] , log : ( e ) => p . logs . unshift ( ` [ ${ nt ( ) . toFixed ( 2 ) } ].time [ ${ e } ].info ` ) , error : ( e ) => p . logs . unshift ( ` [ ${ nt ( ) . toFixed ( 2 ) } ].time [ ${ e } ].error ` ) , curRecording : null , get paused ( ) {
return t . paused ;
} , set paused ( e ) {
t . paused = e , e ? w . ctx . suspend ( ) : w . ctx . resume ( ) ;
} } ;
function Z ( ) {
return t . dt * C . timeScale ;
}
_ _name ( Z , "Z" ) ;
a ( Z , "dt" ) ;
function Jr ( ) {
return B ( "mouseWorldPos()" , "toWorld(mousePos())" ) , Lt ( K ( ) ) ;
}
_ _name ( Jr , "Jr" ) ;
a ( Jr , "mouseWorldPos" ) ;
function Qr ( e , n ) {
e . forEach ( ( r , u ) => {
p . layers [ r ] = u + 1 ;
} ) , n && ( p . defLayer = n ) ;
}
_ _name ( Qr , "Qr" ) ;
a ( Qr , "layers" ) ;
function Zr ( ... e ) {
return e . length > 0 && ( p . cam . pos = f ( ... e ) ) , p . cam . pos . clone ( ) ;
}
_ _name ( Zr , "Zr" ) ;
a ( Zr , "camPos" ) ;
function ei ( ... e ) {
return e . length > 0 && ( p . cam . scale = f ( ... e ) ) , p . cam . scale . clone ( ) ;
}
_ _name ( ei , "ei" ) ;
a ( ei , "camScale" ) ;
function ti ( e ) {
return e !== void 0 && ( p . cam . angle = e ) , p . cam . angle ;
}
_ _name ( ti , "ti" ) ;
a ( ti , "camRot" ) ;
function ni ( e = 12 ) {
p . cam . shake = e ;
}
_ _name ( ni , "ni" ) ;
a ( ni , "shake" ) ;
function rt ( e ) {
return p . cam . transform . multVec2 ( e ) ;
}
_ _name ( rt , "rt" ) ;
a ( rt , "toScreen" ) ;
function Lt ( e ) {
return p . cam . transform . invert ( ) . multVec2 ( e ) ;
}
_ _name ( Lt , "Lt" ) ;
a ( Lt , "toWorld" ) ;
function En ( e ) {
let n = /* @__PURE__ */ new Map ( ) , r = { } , u = { } , c = { _id : lr ( ) , hidden : false , paused : false , children : [ ] , parent : null , add ( s ) {
if ( this !== p . root )
throw new Error ( "Children game object not supported yet" ) ;
let o = En ( s ) ;
return o . parent = this , o . trigger ( "add" ) , Ue ( ( ) => o . trigger ( "load" ) ) , this . children . push ( o ) , o ;
} , readd ( s ) {
return this . remove ( s ) , this . children . push ( s ) , s ;
} , remove ( s ) {
let o = this . children . indexOf ( s ) ;
o !== - 1 && ( s . parent = null , s . trigger ( "destroy" ) , this . children . splice ( o , 1 ) ) ;
} , removeAll ( s ) {
this . every ( s , ( o ) => this . remove ( o ) ) ;
} , update ( ) {
this . paused || ( this . revery ( ( s ) => s . update ( ) ) , this . trigger ( "update" ) ) ;
} , draw ( ) {
this . hidden || ( re ( ) , I ( this . pos ) , ne ( this . scale ) , Je ( this . angle ) , this . every ( ( s ) => s . draw ( ) ) , this . trigger ( "draw" ) , ie ( ) ) ;
} , use ( s ) {
if ( ! s )
return ;
if ( typeof s == "string" )
return this . use ( { id : s } ) ;
s . id && ( this . unuse ( s . id ) , n . set ( s . id , { } ) ) ;
let o = s . id ? n . get ( s . id ) : r ;
o . cleanups = [ ] ;
2022-04-24 09:47:31 +00:00
for ( let h2 in s )
if ( ! ys . has ( h2 ) ) {
if ( typeof s [ h2 ] == "function" ) {
let m = s [ h2 ] . bind ( this ) ;
if ( bs . has ( h2 ) ) {
o . cleanups . push ( this . on ( h2 , m ) ) , o [ h2 ] = m ;
2022-04-18 01:14:39 +00:00
continue ;
} else
2022-04-24 09:47:31 +00:00
o [ h2 ] = m ;
2022-04-18 01:14:39 +00:00
} else
2022-04-24 09:47:31 +00:00
o [ h2 ] = s [ h2 ] ;
this [ h2 ] === void 0 && Object . defineProperty ( this , h2 , { get : ( ) => o [ h2 ] , set : ( m ) => o [ h2 ] = m , configurable : true , enumerable : true } ) ;
2022-04-18 01:14:39 +00:00
}
let d = a ( ( ) => {
if ( ! ! s . require ) {
2022-04-24 09:47:31 +00:00
for ( let h2 of s . require )
if ( ! this . c ( h2 ) )
throw new Error ( ` comp ' ${ s . id } ' requires comp ' ${ h2 } ' ` ) ;
2022-04-18 01:14:39 +00:00
}
} , "checkDeps" ) ;
this . exists ( ) ? ( s . add && s . add . call ( this ) , s . load && Ue ( ( ) => s . load . call ( this ) ) , d ( ) ) : s . require && o . cleanups . push ( this . on ( "add" , d ) ) ;
} , unuse ( s ) {
if ( n . has ( s ) ) {
let o = n . get ( s ) ;
o . cleanups . forEach ( ( d ) => d ( ) ) ;
for ( let d in o )
delete o [ d ] ;
}
n . delete ( s ) ;
} , c ( s ) {
return n . get ( s ) ;
} , get ( s ) {
return this . children . filter ( ( o ) => s ? o . is ( s ) : true ) . sort ( ( o , d ) => {
var g , y , x , W , O , M ;
2022-04-24 09:47:31 +00:00
let h2 = ( y = p . layers [ ( g = o . layer ) != null ? g : p . defLayer ] ) != null ? y : 0 , m = ( W = p . layers [ ( x = d . layer ) != null ? x : p . defLayer ] ) != null ? W : 0 ;
return h2 == m ? ( ( O = o . z ) != null ? O : 0 ) - ( ( M = d . z ) != null ? M : 0 ) : h2 - m ;
2022-04-18 01:14:39 +00:00
} ) ;
} , every ( s , o ) {
if ( typeof s == "function" && o === void 0 )
return this . get ( ) . forEach ( ( d ) => s ( d ) ) ;
if ( typeof s == "string" || Array . isArray ( s ) )
return this . get ( s ) . forEach ( ( d ) => o ( d ) ) ;
} , revery ( s , o ) {
if ( typeof s == "function" && o === void 0 )
return this . get ( ) . reverse ( ) . forEach ( ( d ) => s ( d ) ) ;
if ( typeof s == "string" || Array . isArray ( s ) )
return this . get ( s ) . reverse ( ) . forEach ( ( d ) => o ( d ) ) ;
} , exists ( ) {
var s ;
return this . parent === p . root ? true : ( s = this . parent ) == null ? void 0 : s . exists ( ) ;
} , is ( s ) {
if ( s === "*" )
return true ;
if ( Array . isArray ( s ) ) {
for ( let o of s )
if ( ! this . c ( o ) )
return false ;
return true ;
} else
return this . c ( s ) != null ;
} , on ( s , o ) {
return u [ s ] || ( u [ s ] = new $ ( ) ) , u [ s ] . pushd ( o ) ;
} , action ( ... s ) {
return console . warn ( "action() is deprecated. Use onUpdate() instead" ) , this . onUpdate ( ... s ) ;
} , trigger ( s , ... o ) {
2022-04-24 09:47:31 +00:00
u [ s ] && u [ s ] . forEach ( ( h2 ) => h2 . call ( this , ... o ) ) ;
2022-04-18 01:14:39 +00:00
let d = p . objEvents [ s ] ;
2022-04-24 09:47:31 +00:00
d && d . forEach ( ( h2 ) => {
this . is ( h2 . tag ) && h2 . cb ( this , ... o ) ;
2022-04-18 01:14:39 +00:00
} ) ;
} , destroy ( ) {
var s ;
( s = this . parent ) == null || s . remove ( this ) ;
} , inspect ( ) {
let s = { } ;
for ( let [ o , d ] of n )
s [ o ] = d . inspect ? d . inspect ( ) : null ;
return s ;
} , onUpdate ( s ) {
return this . on ( "update" , s ) ;
} , onDraw ( s ) {
return this . on ( "draw" , s ) ;
} , onDestroy ( s ) {
return this . on ( "destroy" , s ) ;
} , clearEvents ( ) {
u = { } ;
} } ;
for ( let s of e )
c . use ( s ) ;
return c ;
}
_ _name ( En , "En" ) ;
a ( En , "make" ) ;
function qe ( e , n , r ) {
return p . objEvents [ e ] || ( p . objEvents [ e ] = new $ ( ) ) , p . objEvents [ e ] . pushd ( { tag : n , cb : r } ) ;
}
_ _name ( qe , "qe" ) ;
a ( qe , "on" ) ;
function Pe ( e , n ) {
if ( typeof e == "function" && n === void 0 )
return p . root . onUpdate ( e ) ;
if ( typeof e == "string" )
return qe ( "update" , e , n ) ;
}
_ _name ( Pe , "Pe" ) ;
a ( Pe , "onUpdate" ) ;
function Tn ( e , n ) {
if ( typeof e == "function" && n === void 0 )
return p . root . onDraw ( e ) ;
if ( typeof e == "string" )
return qe ( "draw" , e , n ) ;
}
_ _name ( Tn , "Tn" ) ;
a ( Tn , "onDraw" ) ;
function Sn ( e , n , r ) {
2022-04-24 09:47:31 +00:00
let u = qe ( "collide" , e , ( o , d , h2 ) => d . is ( n ) && r ( o , d , h2 ) ) , c = qe ( "collide" , n , ( o , d , h2 ) => d . is ( e ) && r ( d , o , h2 ) ) , s = Pe ( e , ( o ) => {
2022-04-18 01:14:39 +00:00
if ( ! o . area )
throw new Error ( "onCollide() requires the object to have area() component" ) ;
o . _checkCollisions ( n , ( d ) => {
r ( o , d ) ;
} ) ;
} ) ;
return ( ) => [ u , c , s ] . forEach ( ( o ) => o ( ) ) ;
}
_ _name ( Sn , "Sn" ) ;
a ( Sn , "onCollide" ) ;
function Cn ( e , n ) {
return typeof e == "function" ? At ( e ) : Pe ( e , ( r ) => {
if ( ! r . area )
throw new Error ( "onClick() requires the object to have area() component" ) ;
r . isClicked ( ) && n ( r ) ;
} ) ;
}
_ _name ( Cn , "Cn" ) ;
a ( Cn , "onClick" ) ;
function Rn ( e , n , r ) {
return Pe ( e , ( u ) => {
if ( ! u . area )
throw new Error ( "onHover() requires the object to have area() component" ) ;
u . isHovering ( ) ? n ( u ) : r && r ( u ) ;
} ) ;
}
_ _name ( Rn , "Rn" ) ;
a ( Rn , "onHover" ) ;
function Wn ( e , n ) {
return new Promise ( ( r ) => {
p . timers . push ( new fe ( e , ( ) => {
n && n ( ) , r ( ) ;
} ) ) ;
} ) ;
}
_ _name ( Wn , "Wn" ) ;
a ( Wn , "wait" ) ;
function ri ( e , n ) {
let r = false , u = a ( ( ) => {
r || ( n ( ) , Wn ( e , u ) ) ;
} , "newF" ) ;
return u ( ) , ( ) => r = true ;
}
_ _name ( ri , "ri" ) ;
a ( ri , "loop" ) ;
function qt ( e , n ) {
if ( Array . isArray ( e ) ) {
let r = e . map ( ( u ) => qt ( u , n ) ) ;
return ( ) => r . forEach ( ( u ) => u ( ) ) ;
}
return p . on ( "input" , ( ) => Mt ( e ) && n ( ) ) ;
}
_ _name ( qt , "qt" ) ;
a ( qt , "onKeyDown" ) ;
function H ( e , n ) {
if ( Array . isArray ( e ) ) {
let r = e . map ( ( u ) => H ( u , n ) ) ;
return ( ) => r . forEach ( ( u ) => u ( ) ) ;
} else
return typeof e == "function" ? p . on ( "input" , ( ) => Le ( ) && e ( ) ) : p . on ( "input" , ( ) => Le ( e ) && n ( ) ) ;
}
_ _name ( H , "H" ) ;
a ( H , "onKeyPress" ) ;
function Pt ( e , n ) {
if ( Array . isArray ( e ) ) {
let r = e . map ( ( u ) => Pt ( u , n ) ) ;
return ( ) => r . forEach ( ( u ) => u ( ) ) ;
} else
return typeof e == "function" ? p . on ( "input" , ( ) => Le ( ) && e ( ) ) : p . on ( "input" , ( ) => Wt ( e ) && n ( ) ) ;
}
_ _name ( Pt , "Pt" ) ;
a ( Pt , "onKeyPressRepeat" ) ;
function Dt ( e , n ) {
if ( Array . isArray ( e ) ) {
let r = e . map ( ( u ) => Dt ( u , n ) ) ;
return ( ) => r . forEach ( ( u ) => u ( ) ) ;
} else
return typeof e == "function" ? p . on ( "input" , ( ) => tt ( ) && e ( ) ) : p . on ( "input" , ( ) => tt ( e ) && n ( ) ) ;
}
_ _name ( Dt , "Dt" ) ;
a ( Dt , "onKeyRelease" ) ;
function Mn ( e , n ) {
return typeof e == "function" ? p . on ( "input" , ( ) => Ze ( ) && e ( K ( ) ) ) : p . on ( "input" , ( ) => Ze ( e ) && n ( K ( ) ) ) ;
}
_ _name ( Mn , "Mn" ) ;
a ( Mn , "onMouseDown" ) ;
function At ( e , n ) {
return typeof e == "function" ? p . on ( "input" , ( ) => Me ( ) && e ( K ( ) ) ) : p . on ( "input" , ( ) => Me ( e ) && n ( K ( ) ) ) ;
}
_ _name ( At , "At" ) ;
a ( At , "onMousePress" ) ;
function Ln ( e , n ) {
return typeof e == "function" ? p . on ( "input" , ( ) => et ( ) && e ( K ( ) ) ) : p . on ( "input" , ( ) => et ( e ) && n ( K ( ) ) ) ;
}
_ _name ( Ln , "Ln" ) ;
a ( Ln , "onMouseRelease" ) ;
function qn ( e ) {
return p . on ( "input" , ( ) => Rt ( ) && e ( K ( ) , yn ( ) ) ) ;
}
_ _name ( qn , "qn" ) ;
a ( qn , "onMouseMove" ) ;
function Pn ( e ) {
return p . on ( "input" , ( ) => Kr ( ) . forEach ( ( n ) => e ( n ) ) ) ;
}
_ _name ( Pn , "Pn" ) ;
a ( Pn , "onCharInput" ) ;
function Dn ( e ) {
return p . on ( "onTouchStart" , e ) ;
}
_ _name ( Dn , "Dn" ) ;
a ( Dn , "onTouchStart" ) ;
function An ( e ) {
return p . on ( "onTouchMove" , e ) ;
}
_ _name ( An , "An" ) ;
a ( An , "onTouchMove" ) ;
function On ( e ) {
return p . on ( "onTouchEnd" , e ) ;
}
_ _name ( On , "On" ) ;
a ( On , "onTouchEnd" ) ;
function In ( ) {
H ( "f1" , ( ) => {
C . inspect = ! C . inspect ;
} ) , H ( "f2" , ( ) => {
C . clearLog ( ) ;
} ) , H ( "f8" , ( ) => {
C . paused = ! C . paused ;
} ) , H ( "f7" , ( ) => {
C . timeScale = ge ( z ( C . timeScale - 0.2 , 0 , 2 ) , 1 ) ;
} ) , H ( "f9" , ( ) => {
C . timeScale = ge ( z ( C . timeScale + 0.2 , 0 , 2 ) , 1 ) ;
} ) , H ( "f10" , ( ) => {
C . stepFrame ( ) ;
} ) , H ( "f5" , ( ) => {
Yt ( bn ( ) , "kaboom.png" ) ;
} ) , H ( "f6" , ( ) => {
C . curRecording ? ( C . curRecording . download ( ) , C . curRecording = null ) : C . curRecording = Nn ( ) ;
} ) ;
}
_ _name ( In , "In" ) ;
a ( In , "enterDebugMode" ) ;
function Vn ( ) {
H ( "b" , un ) ;
}
_ _name ( Vn , "Vn" ) ;
a ( Vn , "enterBurpMode" ) ;
function Fn ( e ) {
return e !== void 0 && ( p . gravity = e ) , p . gravity ;
}
_ _name ( Fn , "Fn" ) ;
a ( Fn , "gravity" ) ;
function ii ( e , n ) {
}
_ _name ( ii , "ii" ) ;
a ( ii , "regCursor" ) ;
function kn ( e , n ) {
return { target : e , displacement : n , isTop : ( ) => n . y > 0 , isBottom : ( ) => n . y < 0 , isLeft : ( ) => n . x > 0 , isRight : ( ) => n . x < 0 } ;
}
_ _name ( kn , "kn" ) ;
a ( kn , "makeCollision" ) ;
function it ( ... e ) {
return { id : "pos" , pos : f ( ... e ) , moveBy ( ... n ) {
var o ;
let r = f ( ... n ) , u = r . x , c = r . y , s = null ;
if ( this . solid && ( ( o = this . area ) == null ? void 0 : o . shape ) === "rect" ) {
let d = this . worldArea ( ) ;
2022-04-24 09:47:31 +00:00
p . root . every ( ( h2 ) => {
2022-04-18 01:14:39 +00:00
var Oe ;
2022-04-24 09:47:31 +00:00
if ( ! this . exists ( ) || h2 === this || ! h2 . solid || ( ( Oe = h2 . area ) == null ? void 0 : Oe . shape ) !== "rect" )
2022-04-18 01:14:39 +00:00
return ;
2022-04-24 09:47:31 +00:00
let m = h2 . worldArea ( ) , g = yt ( m , d ) ;
2022-04-18 01:14:39 +00:00
if ( ae ( g , f ( 0 ) ) ) {
let _ = Math . min ( Math . abs ( g . p1 . x ) , Math . abs ( g . p2 . x ) , Math . abs ( g . p1 . y ) , Math . abs ( g . p2 . y ) ) , se = ( ( ) => {
switch ( _ ) {
case Math . abs ( g . p1 . x ) :
return f ( _ , 0 ) ;
case Math . abs ( g . p2 . x ) :
return f ( - _ , 0 ) ;
case Math . abs ( g . p1 . y ) :
return f ( 0 , _ ) ;
case Math . abs ( g . p2 . y ) :
return f ( 0 , - _ ) ;
}
} ) ( ) ;
this . pos = this . pos . sub ( se ) , d = this . worldArea ( ) , g = yt ( m , d ) ;
}
let y = { p1 : f ( 0 ) , p2 : f ( u , c ) } , x = 1 , W = g . p1 , O = f ( g . p1 . x , g . p2 . y ) , M = g . p2 , ee = f ( g . p2 . x , g . p1 . y ) , te = 0 , Ae = { right : { p1 : W , p2 : O } , top : { p1 : O , p2 : M } , left : { p1 : M , p2 : ee } , bottom : { p1 : ee , p2 : W } } ;
for ( let _ in Ae ) {
let se = Ae [ _ ] ;
if ( u === 0 && se . p1 . x === 0 && se . p2 . x === 0 || c === 0 && se . p1 . y === 0 && se . p2 . y === 0 ) {
x = 1 ;
break ;
}
let Ie = Jt ( y , se ) ;
Ie != null && ( te ++ , Ie < x && ( x = Ie ) ) ;
}
if ( x < 1 && ! ( x === 0 && te == 1 && ! ae ( g , f ( u , c ) ) ) ) {
let _ = f ( - u * ( 1 - x ) , - c * ( 1 - x ) ) ;
2022-04-24 09:47:31 +00:00
u *= x , c *= x , s = kn ( h2 , _ ) ;
2022-04-18 01:14:39 +00:00
}
} ) ;
}
return this . pos . x += u , this . pos . y += c , s && ( this . trigger ( "collide" , s . target , s ) , s . target . trigger ( "collide" , this , kn ( this , s . displacement . scale ( - 1 ) ) ) ) , s ;
} , move ( ... n ) {
return this . moveBy ( f ( ... n ) . scale ( Z ( ) ) ) ;
} , moveTo ( ... n ) {
if ( typeof n [ 0 ] == "number" && typeof n [ 1 ] == "number" )
return this . moveTo ( f ( n [ 0 ] , n [ 1 ] ) , n [ 2 ] ) ;
let r = n [ 0 ] , u = n [ 1 ] ;
if ( u === void 0 ) {
this . pos = f ( r ) ;
return ;
}
let c = r . sub ( this . pos ) ;
if ( c . len ( ) <= u * Z ( ) ) {
this . pos = f ( r ) ;
return ;
}
this . move ( c . unit ( ) . scale ( u ) ) ;
} , screenPos ( ) {
return this . fixed ? this . pos : rt ( this . pos ) ;
} , inspect ( ) {
return ` ( ${ Math . round ( this . pos . x ) } , ${ Math . round ( this . pos . y ) } ) ` ;
} } ;
}
_ _name ( it , "it" ) ;
a ( it , "pos" ) ;
function st ( ... e ) {
return e . length === 0 ? st ( 1 ) : { id : "scale" , scale : f ( ... e ) , scaleTo ( ... n ) {
this . scale = f ( ... n ) ;
} , inspect ( ) {
return typeof this . scale == "number" ? ` ${ ge ( this . scale , 2 ) } ` : ` ( ${ ge ( this . scale . x , 2 ) } , ${ ge ( this . scale . y , 2 ) } ) ` ;
} } ;
}
_ _name ( st , "st" ) ;
a ( st , "scale" ) ;
function si ( e ) {
return { id : "rotate" , angle : e != null ? e : 0 , inspect ( ) {
return ` ${ Math . round ( this . angle ) } ` ;
} } ;
}
_ _name ( si , "si" ) ;
a ( si , "rotate" ) ;
function oi ( ... e ) {
return { id : "color" , color : E ( ... e ) , inspect ( ) {
return this . color . str ( ) ;
} } ;
}
_ _name ( oi , "oi" ) ;
a ( oi , "color" ) ;
function ge ( e , n ) {
return Number ( e . toFixed ( n ) ) ;
}
_ _name ( ge , "ge" ) ;
a ( ge , "toFixed" ) ;
function ai ( e ) {
return { id : "opacity" , opacity : e != null ? e : 1 , inspect ( ) {
return ` ${ ge ( this . opacity , 2 ) } ` ;
} } ;
}
_ _name ( ai , "ai" ) ;
a ( ai , "opacity" ) ;
function Ot ( e ) {
if ( ! e )
throw new Error ( "please define an origin" ) ;
return { id : "origin" , origin : e , inspect ( ) {
return typeof this . origin == "string" ? this . origin : this . origin . str ( ) ;
} } ;
}
_ _name ( Ot , "Ot" ) ;
a ( Ot , "origin" ) ;
function ui ( e ) {
return { id : "layer" , layer : e , inspect ( ) {
var n ;
return ( n = this . layer ) != null ? n : p . defLayer ;
} } ;
}
_ _name ( ui , "ui" ) ;
a ( ui , "layer" ) ;
function ci ( e ) {
return { id : "z" , z : e , inspect ( ) {
return ` ${ this . z } ` ;
} } ;
}
_ _name ( ci , "ci" ) ;
a ( ci , "z" ) ;
function li ( e , n ) {
return { id : "follow" , require : [ "pos" ] , follow : { obj : e , offset : n != null ? n : f ( 0 ) } , add ( ) {
e . exists ( ) && ( this . pos = this . follow . obj . pos . add ( this . follow . offset ) ) ;
} , update ( ) {
e . exists ( ) && ( this . pos = this . follow . obj . pos . add ( this . follow . offset ) ) ;
} } ;
}
_ _name ( li , "li" ) ;
a ( li , "follow" ) ;
function hi ( e , n ) {
let r = typeof e == "number" ? L . fromAngle ( e ) : e . unit ( ) ;
return { id : "move" , require : [ "pos" ] , update ( ) {
this . move ( r . scale ( n ) ) ;
} } ;
}
_ _name ( hi , "hi" ) ;
a ( hi , "move" ) ;
function It ( e = { } ) {
let n = 0 , r = false ;
return { id : "outview" , require : [ "pos" , "area" ] , isOutOfView ( ) {
var s ;
let u = f ( ( s = e . offset ) != null ? s : 0 ) , c = new ke ( f ( 0 , 0 ) . sub ( u ) , f ( F ( ) , G ( ) ) . add ( u ) ) ;
return ! gt ( this . screenArea ( ) , c ) ;
} , onExitView ( u ) {
return this . on ( "exitView" , u ) ;
} , onEnterView ( u ) {
return this . on ( "enterView" , u ) ;
} , update ( ) {
if ( this . isOutOfView ( ) ) {
if ( r || ( this . trigger ( "exitView" ) , r = true ) , e . delay && ( n += Z ( ) , n < e . delay ) )
return ;
e . hide && ( this . hidden = true ) , e . pause && ( this . paused = true ) , e . destroy && this . destroy ( ) ;
} else
r && ( this . trigger ( "enterView" ) , r = false ) , n = 0 , e . hide && ( this . hidden = false ) , e . pause && ( this . paused = false ) ;
} , inspect ( ) {
return this . isOutOfView ( ) ;
} } ;
}
_ _name ( It , "It" ) ;
a ( It , "outview" ) ;
function di ( e = { } ) {
return typeof e == "number" ? ( B ( "clean(time)" , "cleanup({ delay: time })" ) , D ( P ( { } , It ( { destroy : true , delay : e } ) ) , { id : "cleanup" } ) ) : D ( P ( { } , It ( { destroy : true , onExitView : e . onCleanup , offset : e . offset , delay : e . delay } ) ) , { id : "cleanup" } ) ;
}
_ _name ( di , "di" ) ;
a ( di , "cleanup" ) ;
function fi ( e = { } ) {
var r , u ;
let n = { } ;
return { id : "area" , add ( ) {
this . area . cursor && this . onHover ( ( ) => xn ( this . area . cursor ) ) ;
} , area : { shape : "rect" , offset : ( r = e . offset ) != null ? r : f ( 0 ) , width : e . width , height : e . height , scale : ( u = e . scale ) != null ? u : f ( 1 ) , cursor : e . cursor } , isClicked ( ) {
return Me ( ) && this . isHovering ( ) ;
} , isHovering ( ) {
let c = this . fixed ? K ( ) : Lt ( K ( ) ) ;
return this . hasPoint ( c ) ;
} , isColliding ( c ) {
if ( ! c . area || ! c . exists ( ) )
return false ;
let s = this . worldArea ( ) , o = c . worldArea ( ) ;
return nn ( s , o ) ;
} , isTouching ( c ) {
if ( ! c . area || ! c . exists ( ) )
return false ;
let s = this . worldArea ( ) , o = c . worldArea ( ) ;
return yr ( s , o ) ;
} , onClick ( c ) {
return this . onUpdate ( ( ) => {
this . isClicked ( ) && c ( ) ;
} ) ;
} , onHover ( c , s ) {
return this . onUpdate ( ( ) => {
this . isHovering ( ) ? c ( ) : s && s ( ) ;
} ) ;
} , onCollide ( c , s ) {
2022-04-24 09:47:31 +00:00
let o = this . onUpdate ( ( ) => this . _checkCollisions ( c , s ) ) , d = this . on ( "collide" , ( h2 , m ) => h2 . is ( c ) && s ( h2 , m ) ) ;
return ( ) => [ o , d ] . forEach ( ( h2 ) => h2 ( ) ) ;
2022-04-18 01:14:39 +00:00
} , clicks ( ... c ) {
return B ( "clicks()" , "onClick()" ) , this . onClick ( ... c ) ;
} , hovers ( ... c ) {
return B ( "hovers()" , "onHover()" ) , this . onHover ( ... c ) ;
} , collides ( ... c ) {
return B ( "collides()" , "onCollide()" ) , this . onCollide ( ... c ) ;
} , hasPoint ( c ) {
return Ut ( this . worldArea ( ) , c ) ;
} , pushOut ( c ) {
var g ;
if ( c === this || ( ( g = c . area ) == null ? void 0 : g . shape ) !== "rect" )
return null ;
let s = this . worldArea ( ) , o = c . worldArea ( ) , d = yt ( s , o ) ;
if ( ! ae ( d , f ( 0 ) ) )
return null ;
2022-04-24 09:47:31 +00:00
let h2 = Math . min ( Math . abs ( d . p1 . x ) , Math . abs ( d . p2 . x ) , Math . abs ( d . p1 . y ) , Math . abs ( d . p2 . y ) ) , m = ( ( ) => {
switch ( h2 ) {
2022-04-18 01:14:39 +00:00
case Math . abs ( d . p1 . x ) :
2022-04-24 09:47:31 +00:00
return f ( h2 , 0 ) ;
2022-04-18 01:14:39 +00:00
case Math . abs ( d . p2 . x ) :
2022-04-24 09:47:31 +00:00
return f ( - h2 , 0 ) ;
2022-04-18 01:14:39 +00:00
case Math . abs ( d . p1 . y ) :
2022-04-24 09:47:31 +00:00
return f ( 0 , h2 ) ;
2022-04-18 01:14:39 +00:00
case Math . abs ( d . p2 . y ) :
2022-04-24 09:47:31 +00:00
return f ( 0 , - h2 ) ;
2022-04-18 01:14:39 +00:00
}
} ) ( ) ;
this . pos = this . pos . add ( m ) ;
} , pushOutAll ( ) {
p . root . every ( this . pushOut ) ;
} , _checkCollisions ( c ) {
p . root . every ( c , ( s ) => {
this === s || ! this . exists ( ) || n [ s . _id ] || this . isColliding ( s ) && ( this . trigger ( "collide" , s , null ) , n [ s . _id ] = s ) ;
} ) ;
for ( let s in n ) {
let o = n [ s ] ;
this . isColliding ( o ) || delete n [ s ] ;
}
} , worldArea ( ) {
var m , g , y , x ;
let c = ( m = this . area . width ) != null ? m : this . width , s = ( g = this . area . height ) != null ? g : this . height ;
if ( c == null || s == null )
throw new Error ( "failed to get area dimension" ) ;
let o = f ( ( y = this . scale ) != null ? y : 1 ) . scale ( this . area . scale ) ;
c *= o . x , s *= o . y ;
2022-04-24 09:47:31 +00:00
let d = Ye ( this . origin || Ne ) , h2 = ( ( x = this . pos ) != null ? x : f ( 0 ) ) . add ( this . area . offset ) . sub ( d . add ( 1 , 1 ) . scale ( 0.5 ) . scale ( c , s ) ) ;
return { shape : "rect" , p1 : h2 , p2 : f ( h2 . x + c , h2 . y + s ) } ;
2022-04-18 01:14:39 +00:00
} , screenArea ( ) {
let c = this . worldArea ( ) ;
return this . fixed ? c : { shape : "rect" , p1 : rt ( c . p1 ) , p2 : rt ( c . p2 ) } ;
} } ;
}
_ _name ( fi , "fi" ) ;
a ( fi , "area" ) ;
function De ( e ) {
return { color : e . color , opacity : e . opacity , origin : e . origin , outline : e . outline , fixed : e . fixed , shader : U . shaders [ e . shader ] , uniform : e . uniform } ;
}
_ _name ( De , "De" ) ;
a ( De , "getRenderProps" ) ;
function Vt ( e , n = { } ) {
var s ;
let r = null , u = null ;
2022-04-24 09:47:31 +00:00
function c ( o , d , h2 , m ) {
2022-04-18 01:14:39 +00:00
let g = f ( 1 , 1 ) ;
2022-04-24 09:47:31 +00:00
return h2 && m ? ( g . x = h2 / ( o . width * d . w ) , g . y = m / ( o . height * d . h ) ) : h2 ? ( g . x = h2 / ( o . width * d . w ) , g . y = g . x ) : m && ( g . y = m / ( o . height * d . h ) , g . x = g . y ) , g ;
2022-04-18 01:14:39 +00:00
}
_ _name ( c , "c" ) ;
return a ( c , "calcTexScale" ) , { id : "sprite" , width : 0 , height : 0 , frame : n . frame || 0 , quad : n . quad || new k ( 0 , 0 , 1 , 1 ) , animSpeed : ( s = n . animSpeed ) != null ? s : 1 , load ( ) {
if ( typeof e == "string" ? r = U . sprites [ e ] : r = e , ! r )
throw new Error ( ` sprite not found: " ${ e } " ` ) ;
let o = r . frames [ 0 ] . clone ( ) ;
n . quad && ( o = o . scale ( n . quad ) ) ;
let d = c ( r . tex , o , n . width , n . height ) ;
this . width = r . tex . width * o . w * d . x , this . height = r . tex . height * o . h * d . y , n . anim && this . play ( n . anim ) ;
} , draw ( ) {
hn ( D ( P ( { } , De ( this ) ) , { sprite : r , frame : this . frame , quad : this . quad , flipX : n . flipX , flipY : n . flipY , tiled : n . tiled , width : n . width , height : n . height } ) ) ;
} , update ( ) {
if ( ! u )
return ;
let o = r . anims [ u . name ] ;
if ( typeof o == "number" ) {
this . frame = o ;
return ;
}
if ( o . speed === 0 )
throw new Error ( "sprite anim speed cannot be 0" ) ;
u . timer += Z ( ) * this . animSpeed , u . timer >= 1 / u . speed && ( u . timer = 0 , o . from > o . to ? ( this . frame -- , this . frame < o . to && ( u . loop ? this . frame = o . from : ( this . frame ++ , u . onEnd ( ) , this . stop ( ) ) ) ) : ( this . frame ++ , this . frame > o . to && ( u . loop ? this . frame = o . from : ( this . frame -- , u . onEnd ( ) , this . stop ( ) ) ) ) ) ;
} , play ( o , d = { } ) {
var m , g , y , x , W , O , M ;
if ( ! r ) {
Ue ( ( ) => {
this . play ( o ) ;
} ) ;
return ;
}
2022-04-24 09:47:31 +00:00
let h2 = r . anims [ o ] ;
if ( h2 == null )
2022-04-18 01:14:39 +00:00
throw new Error ( ` anim not found: ${ o } ` ) ;
2022-04-24 09:47:31 +00:00
u && this . stop ( ) , u = { name : o , timer : 0 , loop : ( g = ( m = d . loop ) != null ? m : h2 . loop ) != null ? g : false , pingpong : ( x = ( y = d . pingpong ) != null ? y : h2 . pingpong ) != null ? x : false , speed : ( O = ( W = d . speed ) != null ? W : h2 . speed ) != null ? O : 10 , onEnd : ( M = d . onEnd ) != null ? M : ( ) => {
} } , typeof h2 == "number" ? this . frame = h2 : this . frame = h2 . from , this . trigger ( "animPlay" , o ) , this . trigger ( "animStart" , o ) ;
2022-04-18 01:14:39 +00:00
} , stop ( ) {
if ( ! u )
return ;
let o = u . name ;
u = null , this . trigger ( "animEnd" , o ) ;
} , numFrames ( ) {
return r ? r . frames . length : 0 ;
} , curAnim ( ) {
return u == null ? void 0 : u . name ;
} , flipX ( o ) {
n . flipX = o ;
} , flipY ( o ) {
n . flipY = o ;
} , onAnimEnd ( o , d ) {
2022-04-24 09:47:31 +00:00
return this . on ( "animEnd" , ( h2 ) => {
h2 === o && d ( ) ;
2022-04-18 01:14:39 +00:00
} ) ;
} , onAnimStart ( o , d ) {
2022-04-24 09:47:31 +00:00
return this . on ( "animStart" , ( h2 ) => {
h2 === o && d ( ) ;
2022-04-18 01:14:39 +00:00
} ) ;
} , inspect ( ) {
let o = "" ;
return typeof e == "string" ? o += JSON . stringify ( e ) : o += "[blob]" , o ;
} } ;
}
_ _name ( Vt , "Vt" ) ;
a ( Vt , "sprite" ) ;
function pi ( e , n = { } ) {
function r ( u ) {
var s , o ;
let c = me ( D ( P ( { } , De ( u ) ) , { text : u . text + "" , size : u . textSize , font : u . font , width : n . width && u . width , letterSpacing : u . letterSpacing , lineSpacing : u . lineSpacing , transform : u . transform , styles : u . styles } ) ) ;
return u . width = c . width / ( ( ( s = u . scale ) == null ? void 0 : s . x ) || 1 ) , u . height = c . height / ( ( ( o = u . scale ) == null ? void 0 : o . y ) || 1 ) , c ;
}
_ _name ( r , "r" ) ;
return a ( r , "update" ) , { id : "text" , text : e , textSize : n . size , font : n . font , width : n . width , height : 0 , lineSpacing : n . lineSpacing , letterSpacing : n . letterSpacing , transform : n . transform , styles : n . styles , load ( ) {
r ( this ) ;
} , draw ( ) {
we ( r ( this ) ) ;
} } ;
}
_ _name ( pi , "pi" ) ;
a ( pi , "text" ) ;
function mi ( e , n , r = { } ) {
return { id : "rect" , width : e , height : n , radius : r . radius || 0 , draw ( ) {
Q ( D ( P ( { } , De ( this ) ) , { width : this . width , height : this . height , radius : this . radius } ) ) ;
} , inspect ( ) {
return ` ${ Math . ceil ( this . width ) } , ${ Math . ceil ( this . height ) } ` ;
} } ;
}
_ _name ( mi , "mi" ) ;
a ( mi , "rect" ) ;
function wi ( e , n ) {
return { id : "rect" , width : e , height : n , draw ( ) {
pe ( D ( P ( { } , De ( this ) ) , { width : this . width , height : this . height } ) ) ;
} , inspect ( ) {
return ` ${ Math . ceil ( this . width ) } , ${ Math . ceil ( this . height ) } ` ;
} } ;
}
_ _name ( wi , "wi" ) ;
a ( wi , "uvquad" ) ;
function gi ( e ) {
return { id : "circle" , radius : e , draw ( ) {
Ct ( D ( P ( { } , De ( this ) ) , { radius : this . radius } ) ) ;
} , inspect ( ) {
return ` ${ Math . ceil ( this . radius ) } ` ;
} } ;
}
_ _name ( gi , "gi" ) ;
a ( gi , "circle" ) ;
function Ui ( e = 1 , n = E ( 0 , 0 , 0 ) ) {
return { id : "outline" , outline : { width : e , color : n } } ;
}
_ _name ( Ui , "Ui" ) ;
a ( Ui , "outline" ) ;
function Gn ( e , n ) {
let r = new $ ( ) ;
return e && n && r . pushd ( new fe ( e , n ) ) , { id : "timer" , wait ( u , c ) {
return r . pushd ( new fe ( u , c ) ) ;
} , update ( ) {
r . forEach ( ( u , c ) => {
u . tick ( Z ( ) ) && r . delete ( c ) ;
} ) ;
} } ;
}
_ _name ( Gn , "Gn" ) ;
a ( Gn , "timer" ) ;
let yi = 640 , bi = 65536 ;
function xi ( e = { } ) {
var s , o , d ;
let n = 0 , r = null , u = null , c = true ;
return { id : "body" , require : [ "pos" , "area" ] , jumpForce : ( s = e . jumpForce ) != null ? s : yi , weight : ( o = e . weight ) != null ? o : 1 , solid : ( d = e . solid ) != null ? d : true , update ( ) {
var m ;
2022-04-24 09:47:31 +00:00
let h2 = false ;
2022-04-18 01:14:39 +00:00
if ( r ) {
let g = this . worldArea ( ) , y = r . worldArea ( ) , x = g . p2 . y , W = y . p1 . y , O = g . p1 . x , M = g . p2 . x , ee = y . p1 . x , te = y . p2 . x ;
2022-04-24 09:47:31 +00:00
! r . exists ( ) || x !== W || M < ee || O > te ? ( this . trigger ( "fall" , r ) , r = null , u = null , h2 = true ) : u && r . pos && ( this . pos = this . pos . add ( r . pos . sub ( u ) ) , u = r . pos . clone ( ) ) ;
2022-04-18 01:14:39 +00:00
}
if ( ! r ) {
let g = this . move ( 0 , n ) ;
if ( g )
if ( g . isBottom ( ) ) {
r = g . target ;
let y = n ;
2022-04-24 09:47:31 +00:00
n = 0 , r . pos && ( u = r . pos . clone ( ) ) , h2 || ( this . trigger ( "ground" , r ) , c = true ) ;
2022-04-18 01:14:39 +00:00
} else
g . isTop ( ) && ( n = 0 , this . trigger ( "headbutt" , g . target ) ) ;
n += Fn ( ) * this . weight * Z ( ) , n = Math . min ( n , ( m = e . maxVel ) != null ? m : bi ) ;
}
} , curPlatform ( ) {
return r ;
} , isGrounded ( ) {
return r !== null ;
} , grounded ( ) {
return B ( "grounded()" , "isGrounded()" ) , this . isGrounded ( ) ;
} , isFalling ( ) {
return n > 0 ;
} , falling ( ) {
return B ( "falling()" , "isFalling()" ) , this . isFalling ( ) ;
2022-04-24 09:47:31 +00:00
} , jump ( h2 ) {
r = null , u = null , n = - h2 || - this . jumpForce ;
} , doubleJump ( h2 ) {
this . isGrounded ( ) ? this . jump ( h2 ) : c && ( c = false , this . jump ( h2 ) , this . trigger ( "doubleJump" ) ) ;
} , onGround ( h2 ) {
return this . on ( "ground" , h2 ) ;
} , onFall ( h2 ) {
return this . on ( "fall" , h2 ) ;
} , onHeadbutt ( h2 ) {
return this . on ( "headbutt" , h2 ) ;
} , onDoubleJump ( h2 ) {
return this . on ( "doubleJump" , h2 ) ;
2022-04-18 01:14:39 +00:00
} } ;
}
_ _name ( xi , "xi" ) ;
a ( xi , "body" ) ;
function vi ( e , n = { } ) {
let r = U . shaders [ e ] ;
return { id : "shader" , shader : e , uniform : n } ;
}
_ _name ( vi , "vi" ) ;
a ( vi , "shader" ) ;
function Ei ( ) {
return { id : "solid" , require : [ "area" ] , solid : true } ;
}
_ _name ( Ei , "Ei" ) ;
a ( Ei , "solid" ) ;
function Ti ( ) {
return { id : "fixed" , fixed : true } ;
}
_ _name ( Ti , "Ti" ) ;
a ( Ti , "fixed" ) ;
function Ft ( ) {
return { id : "stay" , stay : true } ;
}
_ _name ( Ft , "Ft" ) ;
a ( Ft , "stay" ) ;
function Si ( e ) {
if ( e == null )
throw new Error ( "health() requires the initial amount of hp" ) ;
return { id : "health" , hurt ( n = 1 ) {
this . setHP ( e - n ) , this . trigger ( "hurt" ) ;
} , heal ( n = 1 ) {
this . setHP ( e + n ) , this . trigger ( "heal" ) ;
} , hp ( ) {
return e ;
} , setHP ( n ) {
e = n , e <= 0 && this . trigger ( "death" ) ;
} , onHurt ( n ) {
return this . on ( "hurt" , n ) ;
} , onHeal ( n ) {
return this . on ( "heal" , n ) ;
} , onDeath ( n ) {
return this . on ( "death" , n ) ;
} , inspect ( ) {
return ` ${ e } ` ;
} } ;
}
_ _name ( Si , "Si" ) ;
a ( Si , "health" ) ;
function Ci ( e , n = { } ) {
var s ;
if ( e == null )
throw new Error ( "lifespan() requires time" ) ;
let r = 0 , u = ( s = n . fade ) != null ? s : 0 , c = Math . max ( e - u , 0 ) ;
return { id : "lifespan" , update ( ) {
r += Z ( ) , r >= c && ( this . opacity = dt ( r , c , e , 1 , 0 ) ) , r >= e && this . destroy ( ) ;
} } ;
}
_ _name ( Ci , "Ci" ) ;
a ( Ci , "lifespan" ) ;
function Ri ( e , n , r ) {
if ( ! e )
throw new Error ( "state() requires an initial state" ) ;
let u = { } ;
function c ( d ) {
u [ d ] || ( u [ d ] = { enter : [ ] , leave : [ ] , update : [ ] , draw : [ ] } ) ;
}
_ _name ( c , "c" ) ;
a ( c , "initStateHook" ) ;
2022-04-24 09:47:31 +00:00
function s ( d , h2 , m ) {
c ( h2 ) , u [ h2 ] [ d ] . push ( m ) ;
2022-04-18 01:14:39 +00:00
}
_ _name ( s , "s" ) ;
a ( s , "on" ) ;
2022-04-24 09:47:31 +00:00
function o ( d , h2 , ... m ) {
c ( h2 ) , u [ h2 ] [ d ] . forEach ( ( g ) => g ( ... m ) ) ;
2022-04-18 01:14:39 +00:00
}
_ _name ( o , "o" ) ;
2022-04-24 09:47:31 +00:00
return a ( o , "trigger" ) , { id : "state" , state : e , enterState ( d , ... h2 ) {
2022-04-18 01:14:39 +00:00
if ( n && ! n . includes ( d ) )
throw new Error ( ` State not found: ${ d } ` ) ;
let m = this . state ;
if ( r ) {
if ( ! ( r == null ? void 0 : r [ m ] ) )
return ;
let g = typeof r [ m ] == "string" ? [ r [ m ] ] : r [ m ] ;
if ( ! g . includes ( d ) )
throw new Error ( ` Cannot transition state from " ${ m } " to " ${ d } ". Available transitions: ${ g . map ( ( y ) => ` " ${ y } " ` ) . join ( ", " ) } ` ) ;
}
2022-04-24 09:47:31 +00:00
o ( "leave" , m , ... h2 ) , this . state = d , o ( "enter" , d , ... h2 ) , o ( "enter" , ` ${ m } -> ${ d } ` , ... h2 ) ;
} , onStateTransition ( d , h2 , m ) {
s ( "enter" , ` ${ d } -> ${ h2 } ` , m ) ;
} , onStateEnter ( d , h2 ) {
s ( "enter" , d , h2 ) ;
} , onStateUpdate ( d , h2 ) {
s ( "update" , d , h2 ) ;
} , onStateDraw ( d , h2 ) {
s ( "draw" , d , h2 ) ;
} , onStateLeave ( d , h2 ) {
s ( "leave" , d , h2 ) ;
2022-04-18 01:14:39 +00:00
} , update ( ) {
o ( "update" , this . state ) ;
} , draw ( ) {
o ( "draw" , this . state ) ;
} , inspect ( ) {
return this . state ;
} } ;
}
_ _name ( Ri , "Ri" ) ;
a ( Ri , "state" ) ;
function Ue ( e ) {
t . loaded ? e ( ) : p . on ( "load" , e ) ;
}
_ _name ( Ue , "Ue" ) ;
a ( Ue , "onLoad" ) ;
function Wi ( e , n ) {
p . scenes [ e ] = n ;
}
_ _name ( Wi , "Wi" ) ;
a ( Wi , "scene" ) ;
function Mi ( e , ... n ) {
if ( ! p . scenes [ e ] )
throw new Error ( ` scene not found: ${ e } ` ) ;
let r = p . on ( "updateStart" , ( ) => {
p . events = { } , p . objEvents = { add : new $ ( ) , update : new $ ( ) , draw : new $ ( ) , destroy : new $ ( ) } , p . root . every ( ( u ) => {
u . is ( "stay" ) || p . root . remove ( u ) ;
2022-04-24 09:47:31 +00:00
} ) , p . root . clearEvents ( ) , p . timers = new $ ( ) , p . cam = { pos : ot ( ) , scale : f ( 1 ) , angle : 0 , shake : 0 , transform : new R ( ) } , p . layers = { } , p . defLayer = null , p . gravity = Vr , p . scenes [ e ] ( ... n ) , i2 . debug !== false && In ( ) , i2 . burp && Vn ( ) , r ( ) ;
2022-04-18 01:14:39 +00:00
} ) ;
}
_ _name ( Mi , "Mi" ) ;
a ( Mi , "go" ) ;
function Li ( e , n ) {
try {
return JSON . parse ( window . localStorage [ e ] ) ;
} catch ( r ) {
return n ? ( _n ( e , n ) , n ) : null ;
}
}
_ _name ( Li , "Li" ) ;
a ( Li , "getData" ) ;
function _n ( e , n ) {
window . localStorage [ e ] = JSON . stringify ( n ) ;
}
_ _name ( _n , "_n" ) ;
a ( _n , "setData" ) ;
function Bn ( e ) {
let n = e ( ye ) ;
for ( let r in n )
2022-04-24 09:47:31 +00:00
ye [ r ] = n [ r ] , i2 . global !== false && ( window [ r ] = n [ r ] ) ;
2022-04-18 01:14:39 +00:00
return ye ;
}
_ _name ( Bn , "Bn" ) ;
a ( Bn , "plug" ) ;
function ot ( ) {
return f ( F ( ) / 2 , G ( ) / 2 ) ;
}
_ _name ( ot , "ot" ) ;
a ( ot , "center" ) ;
function qi ( e , n ) {
return { id : "grid" , gridPos : n . clone ( ) , setGridPos ( ... r ) {
let u = f ( ... r ) ;
this . gridPos = u . clone ( ) , this . pos = f ( e . offset ( ) . x + this . gridPos . x * e . gridWidth ( ) , e . offset ( ) . y + this . gridPos . y * e . gridHeight ( ) ) ;
} , moveLeft ( ) {
this . setGridPos ( this . gridPos . add ( f ( - 1 , 0 ) ) ) ;
} , moveRight ( ) {
this . setGridPos ( this . gridPos . add ( f ( 1 , 0 ) ) ) ;
} , moveUp ( ) {
this . setGridPos ( this . gridPos . add ( f ( 0 , - 1 ) ) ) ;
} , moveDown ( ) {
this . setGridPos ( this . gridPos . add ( f ( 0 , 1 ) ) ) ;
} } ;
}
_ _name ( qi , "qi" ) ;
a ( qi , "grid" ) ;
function Pi ( e , n ) {
if ( ! n . width || ! n . height )
throw new Error ( "Must provide level grid width & height." ) ;
let r = [ ] , u = f ( n . pos || f ( 0 ) ) , c = 0 , s = { offset ( ) {
return u . clone ( ) ;
} , gridWidth ( ) {
return n . width ;
} , gridHeight ( ) {
return n . height ;
} , getPos ( ... o ) {
let d = f ( ... o ) ;
return f ( u . x + d . x * n . width , u . y + d . y * n . height ) ;
} , spawn ( o , ... d ) {
2022-04-24 09:47:31 +00:00
let h2 = f ( ... d ) , m = ( ( ) => {
2022-04-18 01:14:39 +00:00
if ( n [ o ] ) {
if ( typeof n [ o ] != "function" )
throw new Error ( "level symbol def must be a function returning a component list" ) ;
2022-04-24 09:47:31 +00:00
return n [ o ] ( h2 ) ;
2022-04-18 01:14:39 +00:00
} else if ( n . any )
2022-04-24 09:47:31 +00:00
return n . any ( o , h2 ) ;
2022-04-18 01:14:39 +00:00
} ) ( ) ;
if ( ! m )
return ;
2022-04-24 09:47:31 +00:00
let g = f ( u . x + h2 . x * n . width , u . y + h2 . y * n . height ) ;
2022-04-18 01:14:39 +00:00
for ( let x of m )
if ( x . id === "pos" ) {
g . x += x . pos . x , g . y += x . pos . y ;
break ;
}
2022-04-24 09:47:31 +00:00
m . push ( it ( g ) ) , m . push ( qi ( this , h2 ) ) ;
2022-04-18 01:14:39 +00:00
let y = p . root . add ( m ) ;
return r . push ( y ) , y ;
} , width ( ) {
return c * n . width ;
} , height ( ) {
return e . length * n . height ;
} , destroy ( ) {
for ( let o of r )
o . destroy ( ) ;
} } ;
return e . forEach ( ( o , d ) => {
2022-04-24 09:47:31 +00:00
let h2 = o . split ( "" ) ;
c = Math . max ( h2 . length , c ) , h2 . forEach ( ( m , g ) => {
2022-04-18 01:14:39 +00:00
s . spawn ( m , f ( g , d ) ) ;
} ) ;
} ) , s ;
}
_ _name ( Pi , "Pi" ) ;
a ( Pi , "addLevel" ) ;
function Nn ( e ) {
let n = t . canvas . captureStream ( e ) , r = w . ctx . createMediaStreamDestination ( ) ;
w . masterNode . connect ( r ) ;
let u = r . stream , [ c ] = u . getAudioTracks ( ) , s = new MediaRecorder ( n ) , o = [ ] ;
return s . ondataavailable = ( d ) => {
d . data . size > 0 && o . push ( d . data ) ;
} , s . onerror = ( d ) => {
2022-04-24 09:47:31 +00:00
w . masterNode . disconnect ( r ) , n . getTracks ( ) . forEach ( ( h2 ) => h2 . stop ( ) ) ;
2022-04-18 01:14:39 +00:00
} , s . start ( ) , { resume ( ) {
s . resume ( ) ;
} , pause ( ) {
s . pause ( ) ;
} , download ( d = "kaboom.mp4" ) {
s . onstop = ( ) => {
ur ( new Blob ( o , { type : "video/mp4" } ) , d ) ;
2022-04-24 09:47:31 +00:00
} , s . stop ( ) , w . masterNode . disconnect ( r ) , n . getTracks ( ) . forEach ( ( h2 ) => h2 . stop ( ) ) ;
2022-04-18 01:14:39 +00:00
} } ;
}
_ _name ( Nn , "Nn" ) ;
a ( Nn , "record" ) ;
function Di ( ) {
B ( "focus()" , "canvas.focus()" ) , t . canvas . focus ( ) ;
}
_ _name ( Di , "Di" ) ;
a ( Di , "focus" ) ;
function jn ( ) {
return document . activeElement === t . canvas ;
}
_ _name ( jn , "jn" ) ;
a ( jn , "isFocused" ) ;
function kt ( e ) {
return p . root . add ( e ) ;
}
_ _name ( kt , "kt" ) ;
a ( kt , "add" ) ;
function Ai ( e ) {
return p . root . readd ( e ) ;
}
_ _name ( Ai , "Ai" ) ;
a ( Ai , "readd" ) ;
function at ( e ) {
return p . root . remove ( e ) ;
}
_ _name ( at , "at" ) ;
a ( at , "destroy" ) ;
function Oi ( e ) {
return p . root . removeAll ( e ) ;
}
_ _name ( Oi , "Oi" ) ;
a ( Oi , "destroyAll" ) ;
function Ii ( ... e ) {
return p . root . get ( ... e ) ;
}
_ _name ( Ii , "Ii" ) ;
a ( Ii , "get" ) ;
function Vi ( ... e ) {
return p . root . every ( ... e ) ;
}
_ _name ( Vi , "Vi" ) ;
a ( Vi , "every" ) ;
function Fi ( ... e ) {
return p . root . revery ( ... e ) ;
}
_ _name ( Fi , "Fi" ) ;
a ( Fi , "revery" ) ;
function Yn ( e = 2 , n = 1 ) {
let r = 0 ;
return { id : "explode" , require : [ "scale" ] , update ( ) {
let u = Math . sin ( r * e ) * n ;
u < 0 && at ( this ) , this . scale = f ( u ) , r += Z ( ) ;
} } ;
}
_ _name ( Yn , "Yn" ) ;
a ( Yn , "explode" ) ;
let $n = null , Xn = null ;
J ( null , Lr ) . then ( ( e ) => $n = e ) , J ( null , qr ) . then ( ( e ) => Xn = e ) ;
function ki ( e , n = { } ) {
var o , d ;
let r = ( n . speed || 1 ) * 5 , u = n . scale || 1 , c = kt ( [ it ( e ) , Vt ( Xn ) , st ( 0 ) , Ft ( ) , Ot ( "center" ) , Yn ( r , u ) , ... ( ( o = n . boomComps ) != null ? o : ( ) => [ ] ) ( ) ] ) , s = kt ( [ it ( e ) , Vt ( $n ) , st ( 0 ) , Ft ( ) , Ot ( "center" ) , Gn ( 0.4 / r , ( ) => s . use ( Yn ( r , u ) ) ) , ... ( ( d = n . kaComps ) != null ? d : ( ) => [ ] ) ( ) ] ) ;
return { destroy ( ) {
at ( s ) , at ( c ) ;
} } ;
}
_ _name ( ki , "ki" ) ;
a ( ki , "addKaboom" ) ;
function Ms ( ) {
return t . numFrames ;
}
_ _name ( Ms , "Ms" ) ;
a ( Ms , "frames" ) ;
function Kn ( ) {
p . trigger ( "updateStart" ) , p . timers . forEach ( ( e , n ) => {
e . time -= Z ( ) , e . time <= 0 && ( e . action ( ) , p . timers . delete ( n ) ) ;
} ) , p . root . update ( ) ;
}
_ _name ( Kn , "Kn" ) ;
a ( Kn , "updateFrame" ) ;
function Gi ( ) {
let e = p . cam , n = L . fromAngle ( Ge ( 0 , 360 ) ) . scale ( e . shake ) ;
e . shake = Ve ( e . shake , 0 , 5 * Z ( ) ) , e . transform = new R ( ) . translate ( ot ( ) ) . scale ( e . scale ) . rotateZ ( e . angle ) . translate ( e . pos . scale ( - 1 ) . add ( n ) ) , p . root . draw ( ) ;
}
_ _name ( Gi , "Gi" ) ;
a ( Gi , "drawFrame" ) ;
function _i ( ) {
let e = A ( ) ;
if ( e === 1 )
t . loaded = true , p . trigger ( "load" ) ;
else {
let n = F ( ) / 2 , r = 24 / t . scale , u = f ( F ( ) / 2 , G ( ) / 2 ) . sub ( f ( n / 2 , r / 2 ) ) ;
Q ( { pos : f ( 0 ) , width : F ( ) , height : G ( ) , color : E ( 0 , 0 , 0 ) } ) , Q ( { pos : u , width : n , height : r , fill : false , outline : { width : 4 / t . scale } } ) , Q ( { pos : u , width : n * e , height : r } ) ;
}
}
_ _name ( _i , "_i" ) ;
a ( _i , "drawLoadScreen" ) ;
function Hn ( e , n ) {
let r = f ( 8 ) ;
re ( ) , I ( e ) , ne ( 1 / t . scale ) ;
let u = me ( { text : n , font : U . fonts [ rn ] , size : 16 , pos : r , color : E ( 255 , 255 , 255 ) , fixed : true } ) , c = u . width + r . x * 2 , s = u . height + r . x * 2 ;
e . x + c / t . scale >= F ( ) && I ( f ( - c , 0 ) ) , e . y + s / t . scale >= G ( ) && I ( f ( 0 , - s ) ) , Q ( { width : c , height : s , color : E ( 0 , 0 , 0 ) , radius : 4 , opacity : 0.8 , fixed : true } ) , we ( u ) , ie ( ) ;
}
_ _name ( Hn , "Hn" ) ;
a ( Hn , "drawInspectText" ) ;
function zn ( ) {
var e , n ;
if ( C . inspect ) {
2022-04-24 09:47:31 +00:00
let r = null , u = v . fromArray ( ( e = i2 . inspectColor ) != null ? e : [ 0 , 0 , 255 ] ) ;
2022-04-18 01:14:39 +00:00
if ( p . root . every ( ( c ) => {
if ( ! c . area || c . hidden )
return ;
r || c . isHovering ( ) && ( r = c ) ;
2022-04-24 09:47:31 +00:00
let s = r === c ? 8 : 4 , o = c . worldArea ( ) , d = o . p2 . x - o . p1 . x , h2 = o . p2 . y - o . p1 . y ;
Q ( { pos : o . p1 , width : d , height : h2 , outline : { width : s , color : u } , fill : false , fixed : c . fixed } ) ;
2022-04-18 01:14:39 +00:00
} ) , r ) {
let c = [ ] , s = r . inspect ( ) ;
for ( let o in s )
s [ o ] ? c . push ( ` ${ o } : ${ s [ o ] } ` ) : c . push ( ` ${ o } ` ) ;
Hn ( K ( ) , c . join ( `
` ));
}
Hn ( f ( 8 / t . scale ) , ` FPS: ${ C . fps ( ) } ` ) ;
}
if ( C . paused ) {
re ( ) , I ( F ( ) , 0 ) , ne ( 1 / t . scale ) , I ( - 8 , 8 ) ;
let r = 32 ;
Q ( { width : r , height : r , origin : "topright" , color : E ( 0 , 0 , 0 ) , opacity : 0.8 , radius : 4 , fixed : true } ) ;
for ( let u = 1 ; u <= 2 ; u ++ )
Q ( { width : 4 , height : r * 0.6 , origin : "center" , pos : f ( - r / 3 * u , r * 0.5 ) , color : E ( 255 , 255 , 255 ) , radius : 2 , fixed : true } ) ;
ie ( ) ;
}
if ( C . timeScale !== 1 ) {
re ( ) , I ( F ( ) , G ( ) ) , ne ( 1 / t . scale ) , I ( - 8 , - 8 ) ;
let r = 8 , u = me ( { text : C . timeScale . toFixed ( 1 ) , font : U . fonts [ rn ] , size : 16 , color : E ( 255 , 255 , 255 ) , pos : f ( - r ) , origin : "botright" , fixed : true } ) ;
Q ( { width : u . width + r * 2 + r * 4 , height : u . height + r * 2 , origin : "botright" , color : E ( 0 , 0 , 0 ) , opacity : 0.8 , radius : 4 , fixed : true } ) ;
for ( let c = 0 ; c < 2 ; c ++ ) {
let s = C . timeScale < 1 ;
fn ( { p1 : f ( - u . width - r * ( s ? 2 : 3.5 ) , - r ) , p2 : f ( - u . width - r * ( s ? 2 : 3.5 ) , - r - u . height ) , p3 : f ( - u . width - r * ( s ? 3.5 : 2 ) , - r - u . height / 2 ) , pos : f ( - c * r * 1 + ( s ? - r * 0.5 : 0 ) , 0 ) , color : E ( 255 , 255 , 255 ) , fixed : true } ) ;
}
we ( u ) , ie ( ) ;
}
if ( C . curRecording && ( re ( ) , I ( 0 , G ( ) ) , ne ( 1 / t . scale ) , I ( 24 , - 24 ) , Ct ( { radius : 12 , color : E ( 255 , 0 , 0 ) , opacity : Kt ( 0 , 1 , nt ( ) * 4 ) , fixed : true } ) , ie ( ) ) , C . showLog && p . logs . length > 0 ) {
re ( ) , I ( 0 , G ( ) ) , ne ( 1 / t . scale ) , I ( 8 , - 8 ) ;
2022-04-24 09:47:31 +00:00
let r = 8 , u = ( n = i2 . logMax ) != null ? n : 1 ;
2022-04-18 01:14:39 +00:00
p . logs . length > u && ( p . logs = p . logs . slice ( 0 , u ) ) ;
let c = me ( { text : p . logs . join ( `
` ), font: U.fonts[rn], pos: f(r, -r), origin: "botleft", size: 16, width: F() * t.scale * 0.6, lineSpacing: r / 2, fixed: true, styles: { time: { color: E(127, 127, 127) }, info: { color: E(255, 255, 255) }, error: { color: E(255, 0, 127) } } });
Q ( { width : c . width + r * 2 , height : c . height + r * 2 , origin : "botleft" , color : E ( 0 , 0 , 0 ) , radius : 4 , opacity : 0.8 , fixed : true } ) , we ( c ) , ie ( ) ;
}
}
_ _name ( zn , "zn" ) ;
2022-04-24 09:47:31 +00:00
a ( zn , "drawDebug" ) , i2 . debug !== false && In ( ) , i2 . burp && Vn ( ) , window . addEventListener ( "error" , ( e ) => {
2022-04-18 01:14:39 +00:00
C . error ( ` Error: ${ e . error . message } ` ) , zr ( ) , Jn ( ( ) => {
A ( ) === 1 && ( He ( ) , zn ( ) , ze ( ) ) ;
} ) ;
} ) ;
function Jn ( e ) {
let n = a ( ( r ) => {
if ( document . visibilityState !== "visible" ) {
t . loopID = requestAnimationFrame ( n ) ;
return ;
}
let u = r / 1e3 , c = u - t . realTime ;
t . realTime = u , t . skipTime || ( t . dt = c , t . time += t . dt , t . fpsCounter . tick ( t . dt ) ) , t . skipTime = false , t . numFrames ++ , e ( ) ;
for ( let s in t . keyStates )
t . keyStates [ s ] = kr ( t . keyStates [ s ] ) ;
for ( let s in t . mouseStates )
t . mouseStates [ s ] = kr ( t . mouseStates [ s ] ) ;
t . charInputted = [ ] , t . isMouseMoved = false , t . isKeyPressed = false , t . isKeyPressedRepeat = false , t . isKeyReleased = false , t . loopID = requestAnimationFrame ( n ) ;
} , "frame" ) ;
t . stopped = false , t . loopID = requestAnimationFrame ( n ) ;
}
_ _name ( Jn , "Jn" ) ;
a ( Jn , "run" ) , Jn ( ( ) => {
2022-04-24 09:47:31 +00:00
Un ( ) , t . loaded ? ( p . trigger ( "input" ) , C . paused || Kn ( ) , He ( ) , Gi ( ) , i2 . debug !== false && zn ( ) , ze ( ) ) : ( He ( ) , _i ( ) , ze ( ) ) ;
2022-04-18 01:14:39 +00:00
} ) , X ( "apl386" , Tr , 45 , 74 ) , X ( "apl386o" , Sr , 45 , 74 ) , X ( "sink" , Cr , 6 , 8 , { chars : "\u2588\u263A\u263B\u2665\u2666\u2663\u2660\u25CF\u25CB\u25AA\u25A1\u25A0\u25D8\u266A\u266B\u2261\u25BA\u25C4\u2302\xDE\xC0\xDF\xD7\xA5\u2191\u2193\u2192\u2190\u25CC\u25CF\u25BC\u25B2 !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u03A7\u2591\u2592\u2593\u1E00\u1E01\u1E02\u2502\u252C\u2524\u250C\u2510\u1E03\u1E04\u253C\u1E05\u1E06\u1E07\u1E08\u1E09\u1E0A\u1E0B\u1E0C\u2500\u251C\u2534\u2514\u2518\u1E0D\u1E0E\u205E\u1E0F\u1E10\u1E11\u1E12\u1E13\u1E14\u1E15\u1E16\u1E17\u1E18\u2584\u1E19\u1E1A\u1E1B\u1E1C\u2026\u1E1D\u1E1E\u1E1F\u1E20\u1E21\u1E22\u1E23\u1E24\u1E25\u1E26\u258C\u2590\u1E27\u1E28\u1E29\u1E2A\u1E2B\u1E2C\u1E2D\u1E2E\u1E2F\u1E30\u1E31\u1E32\u1E33\u1E34\u1E35\u1E36\u1E37\u1E38\u1E39\u1E3A\u1E3B\u1E3C\u1E3D\u1E3E\u1E3F\u1E40\u1E41\u1E42\u1E43\u1E44\u1E45\u1E46\u1E47\u1E48\u1E49\u1E4A\u1E4B\u1E4C\u1E4D\u1E4E\u1E4F\u1E50\u1E51\u1E52\u1E53\u1E54\u1E55\u1E56\u1E57\u1E58\u1E59\u1E5A\u1E5B\u1E5C\u1E5D\u1E5E\u1E5F\u1E60\u1E61\u1E62\u1E63\u1E64\u1E65\u1E66\u1E67\u1E68\u1E69\u1E6A\u1E6B\u1E6C\u1E6D\u1E6E\u1E6F\u1E70\u1E71\u1E72\u1E73\u1E74\u1E75\u1E76\u1E77\u1E78\u1E79\u1E7A\u1E7B\u1E7C" } ) , X ( "sinko" , Rr , 8 , 10 ) , He ( ) , ze ( ) ;
let ye = { loadRoot : q , loadSprite : J , loadSpriteAtlas : Ee , loadSound : Ce , loadFont : X , loadShader : Se , loadAseprite : Et , loadPedit : $e , loadBean : _r , load : S , width : F , height : G , center : ot , dt : Z , time : nt , screenshot : bn , record : Nn , isFocused : jn , focus : Di , cursor : xn , regCursor : ii , fullscreen : Hr , isFullscreen : vn , onLoad : Ue , isTouch : ( ) => t . isTouch , layers : Qr , camPos : Zr , camScale : ei , camRot : ti , shake : ni , toScreen : rt , toWorld : Lt , gravity : Fn , add : kt , readd : Ai , destroy : at , destroyAll : Oi , get : Ii , every : Vi , revery : Fi , pos : it , scale : st , rotate : si , color : oi , opacity : ai , origin : Ot , layer : ui , area : fi , sprite : Vt , text : pi , rect : mi , circle : gi , uvquad : wi , outline : Ui , body : xi , shader : vi , timer : Gn , solid : Ei , fixed : Ti , stay : Ft , health : Si , lifespan : Ci , z : ci , move : hi , outview : It , cleanup : di , follow : li , state : Ri , on : qe , onUpdate : Pe , onDraw : Tn , onCollide : Sn , onClick : Cn , onHover : Rn , onKeyDown : qt , onKeyPress : H , onKeyPressRepeat : Pt , onKeyRelease : Dt , onMouseDown : Mn , onMousePress : At , onMouseRelease : Ln , onMouseMove : qn , onCharInput : Pn , onTouchStart : Dn , onTouchMove : An , onTouchEnd : On , mousePos : K , mouseWorldPos : Jr , mouseDeltaPos : yn , isKeyDown : Mt , isKeyPressed : Le , isKeyPressedRepeat : Wt , isKeyReleased : tt , isMouseDown : Ze , isMousePressed : Me , isMouseReleased : et , isMouseMoved : Rt , loop : ri , wait : Wn , play : Xe , volume : Br , burp : un , audioCtx : w . ctx , Timer : fe , Line : le , Rect : ke , Circle : ht , Vec2 : L , Color : v , Mat4 : R , Quad : k , RNG : be , rng : mr , rand : Ge , randi : Ht , randSeed : wr , vec2 : f , rgb : E , hsl2rgb : fr , quad : pr , choose : Ur , chance : gr , lerp : Ve , map : dt , mapc : dr , wave : Kt , deg2rad : he , rad2deg : Xt , testAreaRect : gt , testAreaLine : Zt , testAreaCircle : en , testAreaPolygon : tn , testAreaPoint : Ut , testAreaArea : nn , testLineLine : ce , testRectRect : zt , testRectLine : ft , testRectPoint : ae , testPolygonPoint : xe , testLinePolygon : _e , testPolygonPolygon : wt , testCircleCircle : Qt , testCirclePoint : mt , testRectPolygon : pt , drawSprite : hn , drawText : Xr , formatText : me , drawRect : Q , drawLine : We , drawLines : dn , drawTriangle : fn , drawCircle : Ct , drawEllipse : pn , drawUVQuad : pe , drawPolygon : Qe , drawFormattedText : we , pushTransform : re , popTransform : ie , pushTranslate : I , pushRotate : Je , pushScale : ne , debug : C , scene : Wi , go : Mi , addLevel : Pi , getData : Li , setData : _n , plug : Bn , ASCII _CHARS : Ar , CP437 _CHARS : hs , canvas : t . canvas , addKaboom : ki , LEFT : L . LEFT , RIGHT : L . RIGHT , UP : L . UP , DOWN : L . DOWN , RED : v . RED , GREEN : v . GREEN , BLUE : v . BLUE , YELLOW : v . YELLOW , MAGENTA : v . MAGENTA , CYAN : v . CYAN , WHITE : v . WHITE , BLACK : v . BLACK , keyIsDown : T ( "keyIsDown()" , "isKeyDown()" , Mt ) , keyIsPressed : T ( "keyIsPressed()" , "isKeyPressed()" , Le ) , keyIsPressedRep : T ( "keyIsPressedRep()" , "isKeyPressedRepeat()" , Wt ) , keyIsReleased : T ( "keyIsReleased()" , "isKeyReleased()" , tt ) , mouseIsDown : T ( "mouseIsDown()" , "isMouseDown()" , Ze ) , mouseIsClicked : T ( "mouseIsClicked()" , "isMousePressed()" , Me ) , mouseIsReleased : T ( "mouseIsReleased()" , "isMouseReleased()" , et ) , mouseIsMoved : T ( "mouseIsMoved()" , "isMouseMoved()" , Rt ) , dir : T ( "dir()" , "Vec2.fromAngle()" , L . fromAngle ) , action : T ( "action()" , "onUpdate()" , Pe ) , render : T ( "render()" , "onDraw()" , Tn ) , collides : T ( "collides()" , "onCollide()" , Sn ) , clicks : T ( "clicks()" , "onClick()" , Cn ) , hovers : T ( "hovers()" , "onHover()" , Rn ) , keyDown : T ( "keyDown()" , "onKeyDown()" , qt ) , keyPress : T ( "keyPress()" , "onKeyPress()" , H ) , keyPressRep : T ( "keyPressRep()" , "onKeyPressRepeat()" , Pt ) , keyRelease : T ( "keyRelease()" , "onKeyRelease()" , Dt ) , mouseDown : T ( "mouseDown()" , "onMouseDown()" , Mn ) , mouseClick : T ( "mouseClick()" , "onMousePress()" , At ) , mouseRelease : T ( "mouseRelease()" , "onMouseRelease()" , Ln ) , mouseMove : T ( "mouseMove()" , "onMouseMove()" , qn ) , charInput : T ( "charInput()" , "onCharInput()" , Pn ) , touchStart : T ( "touchStart()" , "onTouchStart()" , Dn ) , touchMove : T ( "touchMove()" , "onTouchMove()" , An ) , touchEnd : T ( "touchEnd()" , "onTouchEnd()" , On ) , focused : T ( "focused()" , "isFocused()" , jn ) , ready : T ( "ready()" , "onLoad()" , Ue ) } ;
2022-04-24 09:47:31 +00:00
if ( i2 . plugins && i2 . plugins . forEach ( Bn ) , i2 . global !== false )
2022-04-18 01:14:39 +00:00
for ( let e in ye )
window [ e ] = ye [ e ] ;
return ye ;
} , "default" ) ;
2022-04-24 09:47:31 +00:00
// code/easing.js
var easings = {
linear : ( x ) => {
return x ;
} ,
easeInSine : ( x ) => {
return 1 - Math . cos ( x * Math . PI / 2 ) ;
} ,
easeOutSine : ( x ) => {
return Math . sin ( x * Math . PI / 2 ) ;
} ,
easeInOutSine : ( x ) => {
return - ( Math . cos ( Math . PI * x ) - 1 ) / 2 ;
} ,
easeInQuad : ( x ) => {
return x * x ;
} ,
easeOutQuad : ( x ) => {
return 1 - ( 1 - x ) * ( 1 - x ) ;
} ,
easeInOutQuad : ( x ) => {
return x < 0.5 ? 2 * x * x : 1 - Math . pow ( - 2 * x + 2 , 2 ) / 2 ;
} ,
easeInCubic : ( x ) => {
return x * x * x ;
} ,
easeOutCubic : ( x ) => {
return 1 - Math . pow ( 1 - x , 3 ) ;
} ,
easeInOutCubic : ( x ) => {
return x < 0.5 ? 4 * x * x * x : 1 - Math . pow ( - 2 * x + 2 , 3 ) / 2 ;
} ,
easeInQuart : ( x ) => {
return x * x * x * x ;
} ,
easeOutQuart : ( x ) => {
return 1 - Math . pow ( 1 - x , 4 ) ;
} ,
easeInOutQuart : ( x ) => {
return x < 0.5 ? 8 * x * x * x * x : 1 - Math . pow ( - 2 * x + 2 , 4 ) / 2 ;
} ,
easeInQuint : ( x ) => {
return x * x * x * x * x ;
} ,
easeOutQuint : ( x ) => {
return 1 - Math . pow ( 1 - x , 5 ) ;
} ,
easeInOutQuint : ( x ) => {
return x < 0.5 ? 16 * x * x * x * x * x : 1 - Math . pow ( - 2 * x + 2 , 5 ) / 2 ;
} ,
easeInExpo : ( x ) => {
return x === 0 ? 0 : Math . pow ( 2 , 10 * x - 10 ) ;
} ,
easeOutExpo : ( x ) => {
return x === 1 ? 1 : 1 - Math . pow ( 2 , - 10 * x ) ;
} ,
easeInOutExpo : ( x ) => {
return x === 0 ? 0 : x === 1 ? 1 : x < 0.5 ? Math . pow ( 2 , 20 * x - 10 ) / 2 : ( 2 - Math . pow ( 2 , - 20 * x + 10 ) ) / 2 ;
} ,
easeInCirc : ( x ) => {
return 1 - Math . sqrt ( 1 - Math . pow ( x , 2 ) ) ;
} ,
easeOutCirc : ( x ) => {
return Math . sqrt ( 1 - Math . pow ( x - 1 , 2 ) ) ;
} ,
easeInOutCirc : ( x ) => {
return x < 0.5 ? ( 1 - Math . sqrt ( 1 - Math . pow ( 2 * x , 2 ) ) ) / 2 : ( Math . sqrt ( 1 - Math . pow ( - 2 * x + 2 , 2 ) ) + 1 ) / 2 ;
} ,
easeInBack : ( x ) => {
const c1 = 1.70158 ;
const c3 = c1 + 1 ;
return c3 * x * x * x - c1 * x * x ;
} ,
easeOutBack : ( x ) => {
const c1 = 1.70158 ;
const c3 = c1 + 1 ;
return 1 + c3 * Math . pow ( x - 1 , 3 ) + c1 * Math . pow ( x - 1 , 2 ) ;
} ,
easeInOutBack : ( x ) => {
const c1 = 1.70158 ;
const c2 = c1 * 1.525 ;
return x < 0.5 ? Math . pow ( 2 * x , 2 ) * ( ( c2 + 1 ) * 2 * x - c2 ) / 2 : ( Math . pow ( 2 * x - 2 , 2 ) * ( ( c2 + 1 ) * ( x * 2 - 2 ) + c2 ) + 2 ) / 2 ;
} ,
easeInBounce : ( x ) => {
return 1 - easings . easeOutBounce ( 1 - x ) ;
} ,
easeOutBounce : ( x ) => {
const n1 = 7.5625 ;
const d1 = 2.75 ;
if ( x < 1 / d1 ) {
return n1 * x * x ;
} else if ( x < 2 / d1 ) {
return n1 * ( x -= 1.5 / d1 ) * x + 0.75 ;
} else if ( x < 2.5 / d1 ) {
return n1 * ( x -= 2.25 / d1 ) * x + 0.9375 ;
} else {
return n1 * ( x -= 2.625 / d1 ) * x + 0.984375 ;
}
} ,
easeInOutBounce : ( x ) => {
return x < 0.5 ? ( 1 - easings . easeOutBounce ( 1 - 2 * x ) ) / 2 : ( 1 + easings . easeOutBounce ( 2 * x - 1 ) ) / 2 ;
}
} ;
var tweentypes = {
FOREVER : ( t , st , tl ) => {
if ( t - st >= tl ) {
return "FOREVER" ;
}
return "CONTINUE" ;
} ,
LERPFOREVER : ( t , st , tl ) => {
return "LF" ;
} ,
PINGPONG : ( t , st , tl ) => {
if ( t - st >= tl ) {
return "PING" ;
}
return "CONTINUE" ;
} ,
NORMAL : ( t , st , tl ) => {
if ( t - st >= tl ) {
return "CALLBACK" ;
}
return "CONTINUE" ;
}
} ;
function tween ( func , attrs , timeLen , minVal , maxVal , ease , type , onFinish ) {
var minVal = minVal != void 0 ? minVal : func [ attrs [ 0 ] ] ;
var ease = ease != void 0 ? ease : easings . linear ;
var type = type != void 0 ? type : tweentypes . NORMAL ;
var stTime = time ( ) ;
var onFinish = onFinish != void 0 ? onFinish : "ud" ;
var upd = onUpdate ( ( ) => {
switch ( type ( time ( ) , stTime , timeLen ) ) {
case "CALLBACK" :
for ( h in attrs ) {
func [ attrs [ h ] ] = maxVal ;
}
upd ( ) ;
return onFinish == "ud" ? true : onFinish ( ) ;
case "FOREVER" :
stTime = time ( ) ;
break ;
case "CONTINUE" :
for ( h in attrs ) {
func [ attrs [ h ] ] = minVal ;
}
break ;
case "PING" :
var buffer = minVal ;
minVal = maxVal ;
maxVal = buffer ;
stTime = time ( ) ;
break ;
default :
break ;
}
for ( i in attrs ) {
func [ attrs [ i ] ] = lerp ( minVal , maxVal , ease ( ( time ( ) - stTime ) / timeLen ) ) ;
}
} ) ;
}
_ _name ( tween , "tween" ) ;
2022-04-18 01:14:39 +00:00
// code/main.js
no ( {
width : 700 ,
height : 400 ,
background : [ 0 , 0 , 0 ] ,
crisp : true ,
touchToMouse : true
} ) ;
load ( new Promise ( ( resolve , reject ) => {
loadFont ( "unscii" , "fonts/unscii_8x8.png" , 8 , 8 , { chars : " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" } ) ;
loadSound ( "tutorial" , "sounds/Getting it Done.mp3" ) ;
loadSound ( "faith" , "sounds/The Friendly Faith Plate.mp3" ) ;
2022-04-24 09:47:31 +00:00
loadSound ( "sonic" , "sounds/SonicInMidSim.wav" ) ;
loadSound ( "green" , "sounds/GreenHill.wav" ) ;
2022-04-18 01:14:39 +00:00
loadSound ( "gameover" , "sounds/gameover.mp3" ) ;
loadSound ( "score" , "sounds/score.mp3" ) ;
loadSound ( "metro" , "sounds/metro.wav" ) ;
loadSound ( "explode" , "sounds/explode.mp3" ) ;
loadSprite ( "bgCake" , "sprites/bgCake.png" ) ;
loadSprite ( "jellybeanTitle" , "sprites/jellybeanTitle.png" ) ;
loadSprite ( "logo" , "sprites/logo.png" ) ;
loadSprite ( "jellybeanFail" , "sprites/jellybeanFail.png" ) ;
loadSprite ( "keyA" , "sprites/keyA.png" ) ;
loadSprite ( "keySpace" , "sprites/keySpace.png" ) ;
loadSprite ( "keyClick" , "sprites/keyClick.png" ) ;
loadSprite ( "noteClick" , "sprites/noteClick.png" , {
sliceX : 4 ,
sliceY : 2 ,
anims : {
idle : {
from : 7 ,
to : 7 ,
speed : 30
} ,
click : {
from : 0 ,
to : 7 ,
speed : 60
}
}
} ) ;
loadSound ( "hitsoundFaithPlate" , "sounds/hitsoundFaithPlate.mp3" ) ;
loadSound ( "hitsoundJellyBean" , "sounds/hitsoundJellyBean.wav" ) ;
loadSound ( "hitsoundCarterRedacted" , "sounds/hitsoundJellyBean.wav" ) ;
loadSound ( "hitsoundMarc" , "sounds/hitsoundJellyBean.wav" ) ;
loadSound ( "hitsoundRedVelvety" , "sounds/hitsoundRedVelvety.wav" ) ;
2022-04-24 09:47:31 +00:00
loadSound ( "hitsoundSonicAndTails" , "sounds/hitsoundJellyBean.wav" ) ;
2022-04-18 01:14:39 +00:00
loadSound ( "hitsoundMarkyMark" , "sounds/burp.mp3" ) ;
loadSprite ( "JellyBeanPre" , "sprites/previews/JellyBeanPre.png" ) ;
loadSprite ( "RedVelvetyPre" , "sprites/previews/RedVelvetyPre.png" ) ;
loadSprite ( "MarkyMarkPre" , "sprites/previews/MarkyMarkPre.png" ) ;
loadSprite ( "CarterRedactedPre" , "sprites/previews/CarterRedactedPre.png" ) ;
loadSprite ( "MarcPre" , "sprites/previews/MarcPre.png" ) ;
loadSprite ( "FaithPlatePre" , "sprites/previews/FaithPlatePre.png" ) ;
2022-04-24 09:47:31 +00:00
loadSprite ( "SonicAndTailsPre" , "sprites/previews/SonicAndTailsPre.png" ) ;
2022-04-18 01:14:39 +00:00
loadSprite ( "tutorialBG0" , "sprites/bgCake.png" ) ;
loadSprite ( "tutorialFG0" , "sprites/fgCake0.png" ) ;
loadSprite ( "tutorialFG1" , "sprites/fgCake1.png" ) ;
loadSprite ( "Marctutorial" , "sprites/marcCake.png" , {
sliceX : 3 ,
sliceY : 3 ,
anims : {
idle : {
from : 0 ,
to : 3 ,
speed : 20
} ,
talk : {
from : 4 ,
to : 5 ,
speed : 20
} ,
miss : {
from : 6 ,
to : 8 ,
speed : 10
}
}
} ) ;
loadSprite ( "CarterRedactedtutorial" , "sprites/carterredactedCake.png" , {
sliceX : 3 ,
sliceY : 3 ,
anims : {
idle : {
from : 0 ,
to : 3 ,
speed : 20
} ,
talk : {
from : 4 ,
to : 5 ,
speed : 20
} ,
miss : {
from : 6 ,
to : 8 ,
speed : 10
}
}
} ) ;
loadSprite ( "MarkyMarktutorial" , "sprites/markymarkCake.png" , {
sliceX : 3 ,
sliceY : 4 ,
anims : {
idle : {
from : 0 ,
to : 3 ,
speed : 20
} ,
talk : {
from : 4 ,
to : 7 ,
speed : 40
} ,
miss : {
from : 8 ,
to : 10 ,
speed : 10
}
}
} ) ;
loadSprite ( "RedVelvetytutorial" , "sprites/redvelvetyCake.png" , {
sliceX : 3 ,
sliceY : 4 ,
anims : {
idle : {
from : 0 ,
to : 3 ,
speed : 20
} ,
talk : {
from : 4 ,
to : 5 ,
speed : 20
} ,
dox : {
from : 6 ,
to : 7 ,
speed : 20
} ,
miss : {
from : 8 ,
to : 10 ,
speed : 10
}
}
} ) ;
loadSprite ( "JellyBeantutorial" , "sprites/jellybeanCake.png" , {
sliceX : 3 ,
sliceY : 4 ,
anims : {
idle : {
from : 0 ,
to : 3 ,
speed : 20
} ,
talk : {
from : 4 ,
to : 5 ,
speed : 20
} ,
dox : {
from : 6 ,
to : 7 ,
speed : 20
} ,
miss : {
from : 8 ,
to : 10 ,
speed : 10
}
}
} ) ;
loadSprite ( "faithBG0" , "sprites/bgFaith.png" ) ;
loadSprite ( "faithFG0" , "sprites/fgFaith.png" ) ;
loadSprite ( "FaithPlatefaith" , "sprites/faithplateFaith.png" , {
sliceX : 3 ,
sliceY : 3 ,
anims : {
idle : {
from : 0 ,
to : 3 ,
speed : 20
} ,
talk : {
from : 4 ,
to : 5 ,
speed : 20
} ,
miss : {
from : 6 ,
to : 8 ,
speed : 10
}
}
} ) ;
2022-04-24 09:47:31 +00:00
loadSprite ( "sonicBG0" , "sprites/SonicBG.png" , {
sliceX : 3 ,
sliceY : 3 ,
anims : {
idle : {
from : 0 ,
to : 6 ,
speed : 10 ,
loop : true
}
}
} ) ;
loadSprite ( "sonicFG0" , "sprites/SonicFG.png" , {
sliceX : 3 ,
sliceY : 3 ,
anims : {
idle : {
from : 0 ,
to : 0 ,
speed : 20
}
}
} ) ;
loadSprite ( "SonicAndTailssonic0" , "sprites/SonicMidSim.png" , {
sliceX : 3 ,
sliceY : 4 ,
anims : {
idle : {
from : 0 ,
to : 6 ,
speed : 20
} ,
talk : {
from : 7 ,
to : 8 ,
speed : 20
} ,
miss : {
from : 9 ,
to : 11 ,
speed : 10
}
}
} ) ;
loadSprite ( "SonicAndTailssonic1" , "sprites/TailsMidSim.png" , {
sliceX : 3 ,
sliceY : 9 ,
anims : {
idle : {
from : 0 ,
to : 15 ,
speed : 20
} ,
talk : {
from : 16 ,
to : 23 ,
speed : 20
} ,
miss : {
from : 24 ,
to : 26 ,
speed : 10
}
}
} ) ;
loadSprite ( "greenBG0" , "sprites/SonicBG.png" , {
sliceX : 3 ,
sliceY : 3 ,
anims : {
idle : {
from : 0 ,
to : 6 ,
speed : 10 ,
loop : true
}
}
} ) ;
loadSprite ( "greenFG0" , "sprites/SonicFG.png" , {
sliceX : 3 ,
sliceY : 3 ,
anims : {
idle : {
from : 0 ,
to : 0 ,
speed : 20
}
}
} ) ;
loadSprite ( "SonicAndTailsgreen0" , "sprites/SonicMidSim.png" , {
sliceX : 3 ,
sliceY : 4 ,
anims : {
idle : {
from : 0 ,
to : 6 ,
speed : 20
} ,
talk : {
from : 7 ,
to : 8 ,
speed : 20
} ,
miss : {
from : 9 ,
to : 11 ,
speed : 10
}
}
} ) ;
loadSprite ( "SonicAndTailsgreen1" , "sprites/TailsMidSim.png" , {
sliceX : 3 ,
sliceY : 9 ,
anims : {
idle : {
from : 0 ,
to : 15 ,
speed : 20
} ,
talk : {
from : 16 ,
to : 23 ,
speed : 20
} ,
miss : {
from : 24 ,
to : 26 ,
speed : 10
}
}
} ) ;
2022-04-18 01:14:39 +00:00
resolve ( "All assets loaded." ) ;
} ) ) ;
var charts = {
"tutorial" : [
5 ,
135 ,
"................................................................................................................................J...........J.J...........J.J.J.............J.J.................J...........J.J...........J.J...J...............................J...........J.J...........J.J.J.............J.J...J.............J...........J.J...........J.J...J...............................J...........J.J...........J.J.J.............J.J...J.............J...........J.J...........J.J...J...............................J...........J.J...........J.J.J.............J.J...J...J...J.J...J...........J.J...........J.J...J...............................J.J.J.J.J.J.J.J.J.J.J.J.J.J.J.J...................................J.J.J.J.J.J.J.J.J.J.J.J.J.J.J.....J.............................J.J.J.J.J.J.J.J.J.J.J.J.J.J.J...................................J.J.J.J.J.J.J.J.J.J.J.J.J.J.J.....J.J.....J.J.....J...........J.J.J.J.J.J.J.J.J.J.J.J.J.J.J.J.................................J.J.J.J.J.J.J.J.J.J.J.J.J.J.J.J.....J.J.....J.J.....J.J.....J...................................................................................................................................J...........J.J...........J.J.J.............J.J...J...J...J.J...J...........J.J...........J.J...J...............................J...........J.J...........J.J.J.............J.J...J...J...J.J...J...........J.J...........J.J...J...............................J...........J.J...........J.J.J.............J.J...J...J...J.J...J...........J.J...........J.J...J...............................J...........J.J...........J.J.J.............J.J...J...J...J.J...J...........J.J...........J.J...J..............................................................................................................................................................................................................................................................." ,
1
] ,
"faith" : [
2 ,
120 ,
"................................................................................................................................J...J...J...JJJJJ...J...J...J...J.J.J.J.J.J.J.J.JJJJJJJJJ.J.J.JJJ.J.J.J.J.J.JJJJJ.JJJ.J.J.J.J.J.J.JJJ.JJJ.J.J.J.JJJJJJJJJJJJJJJJJ.J.J.J.J.J.J.J.J.J.J.J.J.J.J.J.J.JJJ.JJJ.JJJ.JJJ.JJJ.J.J.J.J.JJJ.J.JJJJJJJJJJJJJ.J.J.J.JJJJJ.J.J.J.J.J.J.J.JJJJJ.J.J.J.J.JJ.J..J.JJJ.JJJ.J.J.JJJ.JJJ.J.J.J.JJJJJ.J.J.JJJ.JJJJJJJJJJJJJJJJJ.J.JJJ.J.J.JJJ.J.J.JJJ.J.J.JJJ.J.J.JJJ.J.J.JJJ.J.J.JJJJJJJJJJJJJ.J.J.JJJ.J.JJJ.J.J.JJJ.J.J.JJJ.J.J.J.J.J.J.JJJ.JJJJ.JJ.J.J.J.JJ..J...J.J.J.J.J.J.JJJJJJJJJJJJJ.J.J.J.J.J.J.J.J.J.JJJJJ.J.J.J.J.J.J.J.J...J...J.J.J.J.JJJJJJJJJ.J.J.J.J.J.J.JJJ.J.JJJJJJJJJJJJJJJ.J.J.JJJ.J.JJJ.JJJJJJJJJJJJJJJJJ.J.J.JJJ.J.JJJ.JJJJJJJJJJJJJJJJJ.J.J.JJJ.J.JJJ.JJJJJJJJJJJJJJJJJ.J.J.JJJJ.JJJJJJJJJJJJJJJ.JJJJJJJJJJJJJ..J.JJJ.JJJJJJJJJJ....J.J.JJJJJJJ.J.JJJ.JJJJJJJJJJJJJJJJJJJJJ.J.J.J.JJJ.JJJJJJJJJ....JJJJJJJJJ....JJJJJJJ.JJJJJJJ..JJJ..J.JJJJJJJJJJJJJJJ.JJJJJJJ..JJJ....JJJJJJJJJJJJJJJ.JJJJJJJ..JJJ....JJJJJJJJJJJJJJJ.JJJJJJJJ.JJJ..J.JJJJJJJ.J.JJJ.JJJJJJJJJJJJJ.JJJ.J...JJJ.J.JJJ.JJJJJJJJJJJJJ.JJJ.JJJ.JJJ.J.JJJJJJJJJJJJJJJJJJJJJ.JJJ.JJJ.J.JJJ.JJJJJJJJJJJJJJJJJ.JJJ.JJJ.J.JJJ.JJJJJJJJJJJJJJJ...JJJJ........J...JJJJ........J...JJJJ........J...JJJJ........J.J.JJJJ........JJJ.JJJ.JJJ.J.JJJ.J.JJJJ........JJJ.JJJ.JJJ.JJJJJ.J.JJJJ........JJJ.JJJ.JJJ.J.JJJ.J.JJJJ........JJJ.JJJ.JJJ.JJJJJ.J.JJJJJ.......JJJ.J............." ,
4
2022-04-24 09:47:31 +00:00
] ,
"sonic" : [
2 ,
139 ,
"..................................................J.J.J.J.J.JJ....J.J.J.J..J........JJJJ..J.JJ.J..................T.T.T.T.T.TT....T...T.T..T........TTT.T.T.TT.T..................J.J.J.J.J.J.J.J.J...J...........J.J.J.J.J.JJ..J.................T.T.T.T.T.T.T.T.T...T...........T.T.T.T.T.TT..T...............J.....J.....J.J.J.JJ....T.TT........J.J.J.J.J.J.J.J...J.........T.....T.....T.T.T.TT....J.JJ....DD.D............................................................." ,
1
] ,
"green" : [
2 ,
150 ,
"................J.....J.....J.....J.....J...J...J.....J.....J...................J.....J.....J...J.....J.....J...J.....J.................................T.T...T.T...T.T...T...........T.T.T...T.T...T.T...T.............T.T...T.T...T.T...T...........T.T.T...T.T...T.T...T.....T.......J.J...J.J...D.J.T.J.T...T.....J.J.J...J.J...D.J.T.J.T...T.......J.J...J.J...D.J.T.J.T...T.....J.J.J...J.J...D.J.T.J.D...D.....J.....J.....J.....J.T.D.T.J.....J.....J.....J.....J.T.D.T.J.....J.....J.....J.....J.T.D.T.J.T.T.T...T.T.T...T.T.T.T.T.T.T.........J.J...J.J...J.J...J...........J.J.J...J.J...J.J...J.............J.J...J.J...J.J...J...........J.J.J...J.J...J.J...J.....J.......T.T...T.T...D.T.J.T.J...J.....T.T.T...T.T...D.T.J.T.J...J.......T.T...T.T...D.T.J.T.J...J.....T.T.T...T.T...D.T.J.T.J.T.D.....T.....T.....T.....T.J.D.J.T.....T.....T.....T.....T.J.D.J.T.....T.....T.....T.....T.J.D.J.T.J.J.J...J.J.J...J.J.J.J.J.J.J................................................................................................................................................................" ,
1
2022-04-18 01:14:39 +00:00
]
} ;
var songIdx = 0 ;
var idx = 0 ;
scene ( "Game" , ( arr ) => {
var song = arr [ 0 ] ;
var char = arr [ 1 ] ;
var hitsound = "hitsound" + arr [ 1 ] ;
var chart = charts [ song ] ;
var crochet = 60 / chart [ 1 ] * 1e3 ;
var board = width ( ) - strumLine ;
var curBeat ;
var curStep ;
var autoplay = false ;
var debugMode = false ;
var score = 0 ;
var combo = 0 ;
var health = 1 ;
var font = "apl386o" ;
if ( char == "MarkyMark" ) {
font = "unscii" ;
}
var strumLine = width ( ) / 2 ;
const music = play ( song , {
volume : 1 ,
loop : false
} ) ;
const underlay = play ( "score" , {
volume : 1 ,
loop : false
} ) ;
music . pause ( ) ;
wait ( chart [ 0 ] , ( ) => {
underlay . pause ( ) ;
music . play ( ) ;
underlay . play ( music . time ( ) + chart [ 0 ] ) ;
} ) ;
layers ( [
"bg" ,
"JELLYBEAN" ,
"SKELETONS" ,
"fg" ,
"ui0" ,
"ui1"
] , "ui0" ) ;
2022-04-24 09:47:31 +00:00
var player ;
var player2 ;
if ( song == "sonic" || song == "green" ) {
player = add ( [
sprite ( char + song + "0" ) ,
layer ( "JELLYBEAN" ) ,
"dances" ,
pos ( 20 , 108 ) ,
scale ( chart [ 3 ] )
] ) ;
player2 = add ( [
sprite ( char + song + "1" ) ,
layer ( "JELLYBEAN" ) ,
"dances" ,
pos ( 224 , 20 ) ,
scale ( chart [ 3 ] )
] ) ;
} else {
player = add ( [
sprite ( char + song ) ,
layer ( "JELLYBEAN" ) ,
"dances" ,
song == "faith" ? pos ( 0 , 0 ) : pos ( width ( ) / 2 - 162 , height ( ) - 400 ) ,
scale ( chart [ 3 ] )
] ) ;
}
2022-04-18 01:14:39 +00:00
const bg = add ( [
sprite ( song + "BG0" ) ,
layer ( "bg" ) ,
scale ( chart [ 3 ] )
] ) ;
2022-04-24 09:47:31 +00:00
if ( song == "sonic" || song == "green" )
bg . play ( "idle" ) ;
2022-04-18 01:14:39 +00:00
const fg = add ( [
sprite ( song + "FG0" ) ,
song == "faith" ? layer ( "bg" ) : layer ( "fg" ) ,
scale ( chart [ 3 ] )
] ) ;
if ( song == "tutorial" ) {
const fg2 = add ( [
sprite ( song + "FG1" ) ,
layer ( "fg" ) ,
scale ( chart [ 3 ] )
] ) ;
}
const noteClick = add ( [
sprite ( "noteClick" ) ,
scale ( 0.25 ) ,
pos ( strumLine , 15 )
] ) ;
onUpdate ( ( ) => {
if ( health > 1 )
health = 1 ;
if ( health < 0 ) {
health = 0 ;
go ( "Lose" , score ) ;
music . stop ( ) ;
}
if ( music . time ( ) > music . duration ( ) && health >= 0 ) {
go ( "Title" ) ;
}
strumLine = lerp ( 18 , width ( ) / 2 , health ) ;
noteClick . pos . x = strumLine - 5 ;
curBeat = Math . floor ( music . time ( ) * 1e3 / crochet * 10 ) / 10 ;
curStep = Math . floor ( music . time ( ) * 1e3 / ( crochet / 4 ) ) ;
prevBeat = Math . floor ( underlay . time ( ) * 1e3 / crochet ) ;
prevStep = Math . floor ( underlay . time ( ) * 1e3 / ( crochet / 4 ) ) ;
if ( ! get ( "bar" + prevBeat ) . length ) {
var bar = add ( [
prevBeat % 4 == 0 ? rect ( 3 , 50 ) : rect ( 2 , 50 ) ,
pos ( width ( ) , 20 ) ,
color ( 255 , 255 , 255 ) ,
"bar" + prevBeat ,
{
mainBar : prevBeat % 4 == 0 ,
created : underlay . time ( )
} ,
"bar"
] ) ;
}
if ( ! get ( "note" + prevStep ) . length ) {
makeNote ( chart [ 2 ] [ Math . floor ( prevStep ) ] ) ;
}
if ( ! underlay . isPaused ( ) ) {
every ( "bar" , ( j ) => {
j . pos . x = lerp ( width ( ) , strumLine , ( underlay . time ( ) - j . created ) / chart [ 0 ] ) ;
if ( j . pos . x <= strumLine ) {
beatHit ( ) ;
if ( debugMode )
play ( "metro" , { detune : j . mainBar ? 200 : 0 } ) ;
destroy ( j ) ;
}
} ) ;
every ( "note" , ( j ) => {
j . pos . x = lerp ( width ( ) , strumLine , ( underlay . time ( ) - j . created ) / chart [ 0 ] ) ;
if ( autoplay ) {
2022-04-24 09:47:31 +00:00
if ( j . pos . x <= strumLine && ! j . empty ) {
2022-04-18 01:14:39 +00:00
play ( hitsound ) ;
player . play ( "talk" ) ;
destroy ( j ) ;
}
} else {
2022-04-24 09:47:31 +00:00
if ( j . pos . x <= strumLine - 20 && ! j . empty ) {
2022-04-18 01:14:39 +00:00
score -= 200 ;
destroy ( j ) ;
play ( "explode" ) ;
player . play ( "miss" ) ;
shake ( 5 ) ;
combo = 0 ;
health -= 0.1 ;
}
}
2022-04-24 09:47:31 +00:00
if ( j . pos . x >= strumLine - 20 && j . empty ) {
if ( j . pos . x <= strumLine ) {
destroy ( j ) ;
player2 == null ? void 0 : player2 . play ( "talk" ) ;
}
}
2022-04-18 01:14:39 +00:00
} ) ;
}
} ) ;
var mt2 ;
onKeyPress ( "enter" , ( ) => {
if ( ! underlay . isPaused ( ) ) {
underlay . pause ( ) ;
music . pause ( ) ;
mt2 = [ underlay . time ( ) , music . time ( ) ] ;
} else {
underlay . play ( mt2 [ 0 ] ) ;
music . play ( mt2 [ 1 ] ) ;
}
} ) ;
onKeyPress ( "space" , ( ) => {
judgeHitsLol ( ) ;
} ) ;
onKeyPress ( "a" , ( ) => {
autoplay = ! autoplay ;
} ) ;
onKeyPress ( "d" , ( ) => {
debugMode = ! debugMode ;
} ) ;
onClick ( ( ) => {
judgeHitsLol ( ) ;
} ) ;
onTouchStart ( ( ) => {
judgeHitsLol ( ) ;
} ) ;
onDraw ( ( ) => {
drawLine ( {
p1 : vec2 ( 0 , 20 ) ,
p2 : vec2 ( width ( ) , 20 ) ,
width : 2 ,
color : rgb ( 255 , 255 , 255 )
} ) ;
drawLine ( {
p1 : vec2 ( 0 , 70 ) ,
p2 : vec2 ( width ( ) , 70 ) ,
width : 2 ,
color : rgb ( 255 , 255 , 255 )
} ) ;
drawLines ( {
pts : [ vec2 ( strumLine , 18 ) , vec2 ( strumLine + 10 , 18 ) , vec2 ( strumLine + 10 , 72 ) , vec2 ( strumLine , 72 ) , vec2 ( strumLine , 18 ) ] ,
width : 2 ,
pos : vec2 ( 100 , 200 ) ,
color : rgb ( 255 , 255 , 255 )
} ) ;
drawText ( {
text : "MID-SIMULATOR DEMO -- WORK IN PROGRESS!" ,
size : 20 ,
pos : vec2 ( 0 , 0 ) ,
font
} ) ;
if ( debugMode ) {
drawText ( {
text : underlay . time ( ) * 1e3 ,
size : 20 ,
pos : vec2 ( 0 , 20 ) ,
font
} ) ;
drawText ( {
text : curBeat ,
size : 20 ,
pos : vec2 ( 0 , 40 ) ,
font
} ) ;
drawText ( {
text : prevStep + "/" + ( chart [ 2 ] . length - 1 ) ,
size : 20 ,
pos : vec2 ( 0 , 60 ) ,
font
} ) ;
drawText ( {
text : chart [ 2 ] [ Math . floor ( prevStep ) ] ? chart [ 2 ] [ Math . floor ( prevStep ) ] : "." ,
size : 20 ,
pos : vec2 ( 0 , 80 ) ,
font
} ) ;
drawText ( {
text : chart [ 2 ] [ Math . floor ( curStep ) ] ? chart [ 2 ] [ Math . floor ( curStep ) ] : "." ,
size : 20 ,
pos : vec2 ( 0 , 100 ) ,
font
} ) ;
drawText ( {
text : "Health: " + health ,
size : 20 ,
pos : vec2 ( strumLine , 120 ) ,
font
} ) ;
}
drawText ( {
text : "Score: " + score ,
size : 20 ,
pos : vec2 ( strumLine , 80 ) ,
font
} ) ;
drawText ( {
text : "Combo: " + combo ,
size : 20 ,
pos : vec2 ( strumLine , 100 ) ,
font
} ) ;
if ( autoplay ) {
drawText ( {
text : "AUTOPLAY" ,
size : 20 ,
pos : vec2 ( strumLine , 120 ) ,
font
} ) ;
}
} ) ;
function makeNote ( letter ) {
switch ( letter ) {
case "J" :
add ( [
rect ( 10 , 50 ) ,
pos ( width ( ) , 20 ) ,
chart [ 2 ] [ Math . floor ( prevStep ) ] == "F" ? color ( 168 , 56 , 50 ) : color ( 232 , 3 , 252 ) ,
"note" + prevStep ,
"note" ,
{
created : underlay . time ( ) ,
type : chart [ 2 ] [ Math . floor ( prevStep ) ]
}
] ) ;
break ;
2022-04-24 09:47:31 +00:00
case "T" :
add ( [
rect ( 0 , 50 ) ,
pos ( width ( ) , 20 ) ,
"note" + prevStep ,
"note" ,
"empty" ,
{
created : underlay . time ( ) ,
empty : true ,
type : chart [ 2 ] [ Math . floor ( prevStep ) ]
}
] ) ;
break ;
case "D" :
add ( [
rect ( 10 , 50 ) ,
pos ( width ( ) , 20 ) ,
chart [ 2 ] [ Math . floor ( prevStep ) ] == "F" ? color ( 168 , 56 , 50 ) : color ( 232 , 3 , 252 ) ,
"note" + prevStep ,
"note" ,
{
created : underlay . time ( ) ,
type : chart [ 2 ] [ Math . floor ( prevStep ) ]
}
] ) ;
add ( [
rect ( 0 , 50 ) ,
pos ( width ( ) , 20 ) ,
"note" + prevStep ,
"note" ,
"empty" ,
{
created : underlay . time ( ) ,
empty : true ,
type : chart [ 2 ] [ Math . floor ( prevStep ) ]
}
] ) ;
break ;
2022-04-18 01:14:39 +00:00
}
}
_ _name ( makeNote , "makeNote" ) ;
function judgeHitsLol ( ) {
var iv = false ;
every ( "note" , ( j ) => {
if ( ! iv ) {
2022-04-24 09:47:31 +00:00
if ( ! j . empty ) {
var str = "No Rating" ;
var theColor = WHITE ;
if ( j . pos . x >= strumLine - 20 ) {
if ( j . pos . x <= strumLine + 22 ) {
iv = true ;
destroy ( j ) ;
noteClick . play ( "click" ) ;
combo += 1 ;
str = "MID" ;
theColor = RED ;
}
if ( j . pos . x <= strumLine + 12 ) {
play ( hitsound ) ;
player . play ( "talk" ) ;
score += 20 ;
health += 0.01 ;
str = "Perfect!" ;
theColor = MAGENTA ;
}
if ( j . pos . x <= strumLine ) {
score += 50 ;
health += 0.02 ;
str = "Marvelous!" ;
theColor = YELLOW ;
}
if ( j . pos . x <= strumLine - 3 ) {
score += 50 ;
health -= 0.01 ;
str = "Perfect!" ;
theColor = MAGENTA ;
}
if ( j . pos . x <= strumLine - 8 ) {
score -= 100 ;
health -= 0.02 ;
str = "Overshot" ;
theColor = CYAN ;
}
2022-04-18 01:14:39 +00:00
}
2022-04-24 09:47:31 +00:00
if ( str != "No Rating" ) {
var origpos = strumLine - 16 ;
var ratingtxt = add ( [
text ( str , {
size : 30
} ) ,
pos ( origpos , 48 ) ,
color ( theColor ) ,
origin ( "right" )
] ) ;
tween ( ratingtxt . pos , [ "y" ] , 5 , 48 , 300 , easings . easeOutSine , tweentypes . NORMAL ) ;
tween ( ratingtxt , [ "opacity" ] , 5 , 1 , 0 , easings . easeOutSine , tweentypes . NORMAL , function ( ) {
destroy ( ratingtxt ) ;
} ) ;
2022-04-18 01:14:39 +00:00
}
}
}
} ) ;
}
_ _name ( judgeHitsLol , "judgeHitsLol" ) ;
function beatHit ( ) {
every ( "dances" , ( obj ) => {
if ( player . curAnim ( ) != "talk" && player . curAnim ( ) != "miss" ) {
obj . play ( "idle" ) ;
}
} ) ;
}
_ _name ( beatHit , "beatHit" ) ;
} ) ;
scene ( "Help" , ( ) => {
var songs = [
"tutorial" ,
2022-04-24 09:47:31 +00:00
"faith" ,
"green" ,
"sonic"
] ;
var names = [
"Tutorial" ,
"Friendly Faith Plate" ,
"Green Hill Zone" ,
"Emerald Hill Zone"
2022-04-18 01:14:39 +00:00
] ;
var chars = {
tutorial : [
"JellyBean" ,
"RedVelvety" ,
"Marc" ,
"CarterRedacted" ,
"MarkyMark"
] ,
faith : [
"FaithPlate"
2022-04-24 09:47:31 +00:00
] ,
green : [
"SonicAndTails"
] ,
sonic : [
"SonicAndTails"
2022-04-18 01:14:39 +00:00
]
} ;
const bg = add ( [
sprite ( "bgCake" )
] ) ;
onDraw ( ( ) => {
drawText ( {
text : "CONTROLS" ,
size : 30 ,
pos : vec2 ( 25 , 25 )
} ) ;
drawText ( {
text : ": ENABLE AUTOPLAY - ENTER TO PAUSE" ,
size : 30 ,
pos : vec2 ( 60 , 60 )
} ) ;
drawText ( {
text : " / : HIT NOTE" ,
size : 30 ,
pos : vec2 ( 55 , 95 )
} ) ;
drawSprite ( {
sprite : "keyA" ,
width : 60 ,
height : 60 ,
pos : vec2 ( 5 , 45 )
} ) ;
drawSprite ( {
sprite : "keySpace" ,
width : 60 ,
height : 60 ,
pos : vec2 ( 20 , 80 )
} ) ;
drawSprite ( {
sprite : "keyClick" ,
width : 60 ,
height : 60 ,
pos : vec2 ( 95 , 80 )
} ) ;
drawText ( {
text : "SOUND & SHAKING WARNINGS" ,
size : 30 ,
pos : vec2 ( width ( ) / 2 - 105 , 25 )
} ) ;
drawText ( {
text : "CHARACTER (" + ( idx + 1 ) + "/" + chars [ songs [ songIdx ] ] . length + "): " + chars [ songs [ songIdx ] ] [ idx ] ,
size : 30 ,
pos : vec2 ( width ( ) / 2 , 200 ) ,
origin : "top"
} ) ;
drawText ( {
2022-04-24 09:47:31 +00:00
text : "SONG (" + ( songIdx + 1 ) + "/" + songs . length + "): " + names [ songIdx ] . toUpperCase ( ) ,
2022-04-18 01:14:39 +00:00
size : 30 ,
pos : vec2 ( width ( ) / 2 , 160 ) ,
origin : "top"
} ) ;
drawSprite ( {
sprite : chars [ songs [ songIdx ] ] [ idx ] + "Pre" ,
width : 64 ,
height : 64 ,
pos : vec2 ( width ( ) / 2 - 34 , 248 )
} ) ;
} ) ;
add ( [
pos ( 0 , 140 ) ,
rect ( 700 , 200 ) ,
color ( 0 , 0 , 0 )
] ) ;
var lt = add ( [
pos ( 10 , 200 ) ,
text ( "<" , {
size : 30
} ) ,
area ( ) ,
"LeftText"
] ) ;
var rt = add ( [
pos ( width ( ) - 30 , 200 ) ,
text ( ">" , {
size : 30
} ) ,
area ( ) ,
"RightText"
] ) ;
var dt2 = add ( [
pos ( 10 , 160 ) ,
text ( "v" , {
size : 30
} ) ,
area ( ) ,
"DownText"
] ) ;
var ut = add ( [
pos ( width ( ) - 30 , 160 ) ,
text ( "^" , {
size : 30
} ) ,
area ( ) ,
"UpText"
] ) ;
var clickText = add ( [
pos ( 25 , height ( ) - 60 ) ,
text ( "Press Space or Click Here to start" , {
size : 30
} ) ,
area ( ) ,
"TEXT TEXT"
] ) ;
function changeIdx ( amt ) {
idx += amt ;
if ( idx < 0 ) {
idx = chars [ songs [ songIdx ] ] . length - 1 ;
} else if ( idx >= chars [ songs [ songIdx ] ] . length ) {
idx = 0 ;
}
}
_ _name ( changeIdx , "changeIdx" ) ;
function changeSongIdx ( amt ) {
songIdx += amt ;
idx = 0 ;
if ( songIdx < 0 ) {
songIdx = songs . length - 1 ;
} else if ( songIdx >= songs . length ) {
songIdx = 0 ;
}
}
_ _name ( changeSongIdx , "changeSongIdx" ) ;
onKeyPress ( "left" , ( ) => {
changeIdx ( - 1 ) ;
} ) ;
onKeyPress ( "right" , ( ) => {
changeIdx ( 1 ) ;
} ) ;
onKeyPress ( "down" , ( ) => {
2022-04-24 09:47:31 +00:00
changeSongIdx ( 1 ) ;
2022-04-18 01:14:39 +00:00
} ) ;
onKeyPress ( "up" , ( ) => {
2022-04-24 09:47:31 +00:00
changeSongIdx ( - 1 ) ;
2022-04-18 01:14:39 +00:00
} ) ;
onKeyPress ( "`" , ( ) => {
go ( "Chart" , songs [ songIdx ] ) ;
} ) ;
onClick ( "LeftText" , ( ) => {
changeIdx ( - 1 ) ;
} ) ;
onClick ( "RightText" , ( ) => {
changeIdx ( 1 ) ;
} ) ;
onClick ( "DownText" , ( ) => {
2022-04-24 09:47:31 +00:00
changeSongIdx ( 1 ) ;
2022-04-18 01:14:39 +00:00
} ) ;
onClick ( "UpText" , ( ) => {
2022-04-24 09:47:31 +00:00
changeSongIdx ( - 1 ) ;
2022-04-18 01:14:39 +00:00
} ) ;
onKeyPress ( "space" , ( ) => {
go ( "Game" , [ songs [ songIdx ] , chars [ songs [ songIdx ] ] [ idx ] ] ) ;
} ) ;
onClick ( "TEXT TEXT" , ( ) => {
2022-04-24 09:47:31 +00:00
go ( "Game" , [ songs [ songIdx ] , chars [ songs [ songIdx ] ] [ idx ] ] ) ;
2022-04-18 01:14:39 +00:00
} ) ;
} ) ;
scene ( "Title" , ( ) => {
const bg = add ( [
sprite ( "bgCake" )
] ) ;
const jb = add ( [
sprite ( "jellybeanTitle" ) ,
pos ( 0 , height ( ) - 320 )
] ) ;
const logo = add ( [
sprite ( "logo" ) ,
pos ( 0 , 0 ) ,
scale ( 0.5 , 0.5 )
] ) ;
onDraw ( ( ) => {
drawText ( {
text : "SPACE/CLICK TO START" ,
size : 30 ,
pos : vec2 ( width ( ) / 2 - 90 , height ( ) - 60 )
} ) ;
} ) ;
onKeyPress ( "space" , ( ) => {
go ( "Help" , [ "tutorial" ] ) ;
} ) ;
onClick ( ( ) => {
go ( "Help" , [ "tutorial" ] ) ;
} ) ;
onTouchStart ( ( ) => {
go ( "Help" , [ "tutorial" ] ) ;
} ) ;
} ) ;
scene ( "Lose" , ( score ) => {
const lost = add ( [
sprite ( "jellybeanFail" ) ,
"dances" ,
pos ( width ( ) / 2 - 162 , height ( ) / 2 - 162 )
] ) ;
const losemus = play ( "gameover" , {
volume : 1 ,
loop : true
} ) ;
onDraw ( ( ) => {
drawText ( {
text : "YOU LOST LOL WHOOPS" ,
size : 60 ,
pos : vec2 ( 0 , height ( ) - 120 )
} ) ;
drawText ( {
text : "SPACE/CLICK TO RESTART" ,
size : 30 ,
pos : vec2 ( 0 , height ( ) - 60 )
} ) ;
drawText ( {
text : "SCORE: " + score ,
size : 30 ,
pos : vec2 ( 0 , height ( ) - 30 )
} ) ;
} ) ;
onKeyPress ( "space" , ( ) => {
go ( "Title" ) ;
losemus . stop ( ) ;
} ) ;
onClick ( ( ) => {
go ( "Title" ) ;
losemus . stop ( ) ;
} ) ;
onTouchStart ( ( ) => {
go ( "Title" ) ;
losemus . stop ( ) ;
} ) ;
} ) ;
scene ( "Chart" , ( song ) => {
var chart = charts [ song ] ;
var crochet = 60 / chart [ 1 ] * 1e3 ;
var curBeat ;
var curStep ;
var songTime = 0 ;
var tool = "J" ;
const music = play ( song , {
volume : 1 ,
loop : false
} ) ;
music . pause ( ) ;
var lastTargeted = 4 ;
var tempChart = Array . from ( Array ( Math . floor ( music . duration ( ) * 1e3 / ( crochet / 4 ) ) ) , ( ) => "." ) ;
var coords = [
width ( ) * 0.1 ,
width ( ) * 0.2 ,
width ( ) * 0.3 ,
width ( ) * 0.4 ,
width ( ) * 0.5 ,
width ( ) * 0.6 ,
width ( ) * 0.7 ,
width ( ) * 0.8 ,
width ( ) * 0.9
] ;
var theEmpty = add ( [
pos ( width ( ) * 0.2 , height ( ) * 0.8 ) ,
rect ( 60 , 60 ) ,
text ( "." , {
size : 48 ,
width : 60
} ) ,
color ( 255 , 255 , 255 ) ,
outline ( 4 , WHITE ) ,
origin ( "center" ) ,
area ( ) ,
"theEmpty"
] ) ;
var theJ = add ( [
pos ( width ( ) * 0.4 , height ( ) * 0.8 ) ,
rect ( 60 , 60 ) ,
text ( "J" , {
size : 48 ,
width : 60
} ) ,
color ( 255 , 255 , 255 ) ,
outline ( 4 , WHITE ) ,
origin ( "center" ) ,
area ( ) ,
"theJ"
] ) ;
var theP = add ( [
pos ( width ( ) * 0.6 , height ( ) * 0.8 ) ,
2022-04-24 09:47:31 +00:00
rect ( 60 , 30 ) ,
2022-04-18 01:14:39 +00:00
text ( "P" , {
2022-04-24 09:47:31 +00:00
size : 24 ,
2022-04-18 01:14:39 +00:00
width : 60
} ) ,
color ( 255 , 255 , 255 ) ,
outline ( 4 , WHITE ) ,
origin ( "center" ) ,
area ( ) ,
"theP"
] ) ;
2022-04-24 09:47:31 +00:00
var theD = add ( [
pos ( width ( ) * 0.6 , height ( ) * 0.8 + 30 ) ,
rect ( 60 , 30 ) ,
text ( "D" , {
size : 24 ,
width : 60
} ) ,
color ( 255 , 255 , 255 ) ,
outline ( 4 , WHITE ) ,
origin ( "center" ) ,
area ( ) ,
"theD"
] ) ;
2022-04-18 01:14:39 +00:00
var consoleButton = add ( [
pos ( width ( ) * 0.8 , height ( ) * 0.8 ) ,
rect ( 60 , 60 ) ,
text ( "EXPORT" , {
size : 30
} ) ,
color ( 255 , 255 , 255 ) ,
outline ( 4 , WHITE ) ,
origin ( "center" ) ,
area ( ) ,
"consoleButton"
] ) ;
onClick ( "theEmpty" , ( o ) => {
tool = "." ;
} ) ;
onClick ( "theJ" , ( o ) => {
tool = "J" ;
} ) ;
onClick ( "theP" , ( o ) => {
tool = "P" ;
} ) ;
2022-04-24 09:47:31 +00:00
onClick ( "theD" , ( o ) => {
tool = "D" ;
} ) ;
2022-04-18 01:14:39 +00:00
onClick ( "consoleButton" , ( o ) => {
console . log ( tempChart . join ( "" ) ) ;
} ) ;
onUpdate ( ( ) => {
curBeat = Math . floor ( music . time ( ) * 1e3 / crochet * 10 ) / 10 ;
curStep = Math . floor ( music . time ( ) * 1e3 / ( crochet / 4 ) ) ;
if ( mousePos ( ) . y >= height ( ) * 0.4 && mousePos ( ) . y < height ( ) / 2 + 34 ) {
if ( mousePos ( ) . x < width ( ) * 0.15 ) {
lastTargeted = 0 ;
} else if ( mousePos ( ) . x < width ( ) * 0.25 ) {
lastTargeted = 1 ;
} else if ( mousePos ( ) . x < width ( ) * 0.35 ) {
lastTargeted = 2 ;
} else if ( mousePos ( ) . x < width ( ) * 0.45 ) {
lastTargeted = 3 ;
} else if ( mousePos ( ) . x < width ( ) * 0.55 ) {
lastTargeted = 4 ;
} else if ( mousePos ( ) . x < width ( ) * 0.65 ) {
lastTargeted = 5 ;
} else if ( mousePos ( ) . x < width ( ) * 0.75 ) {
lastTargeted = 6 ;
} else if ( mousePos ( ) . x < width ( ) * 0.85 ) {
lastTargeted = 7 ;
} else if ( mousePos ( ) . x < width ( ) ) {
lastTargeted = 8 ;
}
}
} ) ;
onMouseDown ( ( ) => {
if ( mousePos ( ) . y >= height ( ) * 0.4 && mousePos ( ) . y < height ( ) / 2 + 34 ) {
tempChart [ curStep + lastTargeted ] = tool ;
}
} ) ;
onDraw ( ( ) => {
drawText ( {
text : songTime * 1e3 ,
size : 20 ,
pos : vec2 ( 0 )
} ) ;
drawText ( {
text : music . time ( ) * 1e3 ,
size : 20 ,
pos : vec2 ( 0 , 20 )
} ) ;
drawText ( {
text : curBeat ,
size : 20 ,
pos : vec2 ( 0 , 40 )
} ) ;
drawText ( {
text : curStep + "/" + ( tempChart . length - 1 ) ,
size : 20 ,
pos : vec2 ( 0 , 60 )
} ) ;
drawText ( {
text : tool ,
size : 50 ,
pos : vec2 ( width ( ) / 2 , height ( ) * 0.65 ) ,
origin : "center"
} ) ;
drawLine ( {
p1 : vec2 ( coords [ lastTargeted ] - 30 , height ( ) / 2 + 30 ) ,
p2 : vec2 ( coords [ lastTargeted ] + 30 , height ( ) / 2 + 30 ) ,
width : 4 ,
color : rgb ( 255 , 0 , 0 )
} ) ;
drawText ( {
text : tempChart [ curStep ] ? tempChart [ curStep ] : "" ,
size : 30 ,
pos : vec2 ( coords [ 0 ] , height ( ) / 2 ) ,
color : curStep % 4 == 0 ? RED : MAGENTA ,
origin : "center"
} ) ;
drawText ( {
text : tempChart [ curStep + 1 ] ? tempChart [ curStep + 1 ] : "" ,
size : 30 ,
pos : vec2 ( coords [ 1 ] , height ( ) / 2 ) ,
color : ( curStep + 1 ) % 4 == 0 ? RED : WHITE ,
origin : "center"
} ) ;
drawText ( {
text : tempChart [ curStep + 2 ] ? tempChart [ curStep + 2 ] : "" ,
size : 30 ,
pos : vec2 ( coords [ 2 ] , height ( ) / 2 ) ,
color : ( curStep + 2 ) % 4 == 0 ? RED : WHITE ,
origin : "center"
} ) ;
drawText ( {
text : tempChart [ curStep + 3 ] ? tempChart [ curStep + 3 ] : "" ,
size : 30 ,
pos : vec2 ( coords [ 3 ] , height ( ) / 2 ) ,
color : ( curStep + 3 ) % 4 == 0 ? RED : WHITE ,
origin : "center"
} ) ;
drawText ( {
text : tempChart [ curStep + 4 ] ? tempChart [ curStep + 4 ] : "" ,
size : 30 ,
pos : vec2 ( coords [ 4 ] , height ( ) / 2 ) ,
color : ( curStep + 4 ) % 4 == 0 ? RED : WHITE ,
origin : "center"
} ) ;
drawText ( {
text : tempChart [ curStep + 5 ] ? tempChart [ curStep + 5 ] : "" ,
size : 30 ,
pos : vec2 ( coords [ 5 ] , height ( ) / 2 ) ,
color : ( curStep + 5 ) % 4 == 0 ? RED : WHITE ,
origin : "center"
} ) ;
drawText ( {
text : tempChart [ curStep + 6 ] ? tempChart [ curStep + 6 ] : "" ,
size : 30 ,
pos : vec2 ( coords [ 6 ] , height ( ) / 2 ) ,
color : ( curStep + 6 ) % 4 == 0 ? RED : WHITE ,
origin : "center"
} ) ;
drawText ( {
text : tempChart [ curStep + 7 ] ? tempChart [ curStep + 7 ] : "" ,
size : 30 ,
pos : vec2 ( coords [ 7 ] , height ( ) / 2 ) ,
color : ( curStep + 7 ) % 4 == 0 ? RED : WHITE ,
origin : "center"
} ) ;
drawText ( {
text : tempChart [ curStep + 8 ] ? tempChart [ curStep + 8 ] : "" ,
size : 30 ,
pos : vec2 ( coords [ 8 ] , height ( ) / 2 ) ,
color : ( curStep + 8 ) % 4 == 0 ? RED : WHITE ,
origin : "center"
} ) ;
} ) ;
onKeyPress ( "left" , ( ) => {
music . pause ( ) ;
songTime = songTime - crochet / 4 / 1e3 ;
try {
music . play ( songTime ) ;
} catch ( err ) {
console . log ( err ) ;
songTime = 0 ;
music . play ( 0 ) ;
}
music . pause ( ) ;
} ) ;
onKeyPress ( "right" , ( ) => {
music . pause ( ) ;
songTime = songTime + crochet / 4 / 1e3 ;
try {
music . play ( songTime ) ;
} catch ( err ) {
console . log ( err ) ;
songTime = 0 ;
music . play ( 0 ) ;
}
music . pause ( ) ;
} ) ;
onKeyPress ( "space" , ( ) => {
if ( ! music . isPaused ( ) ) {
music . pause ( ) ;
songTime = music . time ( ) ;
} else {
try {
music . play ( songTime ) ;
} catch ( err ) {
console . log ( err ) ;
songTime = 0 ;
music . play ( 0 ) ;
}
}
} ) ;
} ) ;
go ( "Title" ) ;
} ) ( ) ;
//# sourceMappingURL=game.js.map