Skip to content

Commit 37e61ac

Browse files
committed
Initial commit
0 parents  commit 37e61ac

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1328
-0
lines changed

background.js

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
const canvas = document.getElementById('backgroundCanvas');
2+
const gl = canvas.getContext('webgl') || canvas.getContext('experimental-webgl');
3+
4+
if (game.backgroundDisabled) {canvas.style.display = 'none';}
5+
else {canvas.style.display = 'block';}
6+
7+
const vertexShaderSource = `
8+
attribute vec4 a_position;
9+
void main() {
10+
gl_Position = a_position;
11+
}
12+
`;
13+
14+
const fragmentShaderSource = `
15+
precision highp float;
16+
uniform vec2 resolution;
17+
uniform float time;
18+
19+
void main()
20+
{
21+
vec2 uv = -1.0 + 2.0*gl_FragCoord.xy / resolution.xy;
22+
uv.x *= resolution.x / resolution.y;
23+
vec3 color = vec3(0.0);
24+
for( int i=0; i<128; i++ )
25+
{
26+
float pha = sin(float(i)*546.13+1.0)*0.5 + 0.5;
27+
float siz = pow( sin(float(i)*651.74+5.0)*0.5 + 0.5, 4.0 );
28+
float pox = sin(float(i)*321.55+4.1) * resolution.x / resolution.y;
29+
float rad = 0.1+0.5*siz+sin(pha+siz)/4.0;
30+
vec2 pos = vec2( pox+sin(time/15.+pha+siz), -1.0-rad + (2.0+2.0*rad)*mod(pha+0.3*(time/7.)*(0.2+0.8*siz),1.0));
31+
float dis = length( uv - pos );
32+
vec3 col = mix( vec3(0.194*sin(time/6.0)+0.3,0.2,0.3*pha), vec3(1.1*sin(time/9.0)+0.3,0.2*pha,0.4), 0.5+0.5*sin(float(i)));
33+
float f = length(uv-pos)/rad;
34+
f = sqrt(clamp(1.0+(sin((time)*siz)*0.5)*f,0.0,1.0));
35+
color += col.zyx *(1.0-smoothstep( rad*0.15, rad, dis ));
36+
}
37+
color *= sqrt(1.5-0.5*length(uv));
38+
gl_FragColor = vec4(color,1.0);
39+
}
40+
41+
`;
42+
43+
function createShader(gl, type, source) {
44+
const shader = gl.createShader(type);
45+
gl.shaderSource(shader, source);
46+
gl.compileShader(shader);
47+
if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {
48+
console.error('An error occurred compiling the shaders: ' + gl.getShaderInfoLog(shader));
49+
console.error('Shader source:', source);
50+
gl.deleteShader(shader);
51+
return null;
52+
}
53+
return shader;
54+
}
55+
56+
// Function to create and link a shader program
57+
function createShaderProgram(gl, vertexSource, fragmentSource) {
58+
const vertexShader = createShader(gl, gl.VERTEX_SHADER, vertexSource);
59+
const fragmentShader = createShader(gl, gl.FRAGMENT_SHADER, fragmentSource);
60+
61+
const program = gl.createProgram();
62+
gl.attachShader(program, vertexShader);
63+
gl.attachShader(program, fragmentShader);
64+
gl.linkProgram(program);
65+
66+
//if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {
67+
// console.error('Error linking program:', gl.getProgramInfoLog(program));
68+
// return null;
69+
//}
70+
71+
return program;
72+
}
73+
74+
const vertices = new Float32Array([
75+
-1, -1,
76+
1, -1,
77+
-1, 1,
78+
1, 1
79+
]);
80+
81+
const vertexBuffer = gl.createBuffer();
82+
gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer);
83+
gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW);
84+
85+
// Function to initialize the shader program
86+
function initShaderProgram() {
87+
shaderProgram = createShaderProgram(gl, vertexShaderSource, fragmentShaderSource);
88+
89+
if (!shaderProgram) return;
90+
gl.useProgram(shaderProgram);
91+
const a_position = gl.getAttribLocation(shaderProgram, 'a_position');
92+
gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer);
93+
gl.enableVertexAttribArray(a_position);
94+
gl.vertexAttribPointer(a_position, 2, gl.FLOAT, false, 0, 0);
95+
96+
resolutionUniformLocation = gl.getUniformLocation(shaderProgram, 'resolution');
97+
timeUniformLocation = gl.getUniformLocation(shaderProgram, 'time');
98+
//backgroundColor1UniformLocation = gl.getUniformLocation(shaderProgram, 'u_color1');
99+
//backgroundColor2UniformLocation = gl.getUniformLocation(shaderProgram, 'u_color2');
100+
//backgroundColor3UniformLocation = gl.getUniformLocation(shaderProgram, 'u_color3');
101+
}
102+
103+
// Initialize shaders and buffer
104+
initShaderProgram();
105+
106+
let backgroundColor1 = [0.4,1,1];
107+
let backgroundColor2 = [0,0.2,0.2];
108+
let backgroundColor3 = [0.2,0,0.4];
109+
function render(timestamp) {
110+
if (game.backgroundDisabled) {requestAnimationFrame(render); return;}
111+
canvas.width = window.innerWidth;
112+
canvas.height = window.innerHeight;
113+
gl.uniform2f(resolutionUniformLocation, canvas.width, canvas.height);
114+
gl.uniform1f(timeUniformLocation, timestamp / 1000.0);
115+
// gl.uniform3f(backgroundColor1UniformLocation, backgroundColor1[0], backgroundColor1[1], backgroundColor1[2]);
116+
//gl.uniform3f(backgroundColor2UniformLocation, backgroundColor2[0], backgroundColor2[1], backgroundColor2[2]);
117+
//gl.uniform3f(backgroundColor3UniformLocation, backgroundColor3[0], backgroundColor3[1], backgroundColor3[2]);
118+
gl.clearColor(0.0, 0.0, 0.0, 1.0);
119+
gl.clear(gl.COLOR_BUFFER_BIT);
120+
gl.viewport(0,0, canvas.width, canvas.height);
121+
gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
122+
requestAnimationFrame(render);
123+
}
124+
125+
requestAnimationFrame(render);
126+
127+
function enableDisableBackground() {
128+
game.backgroundDisabled = !game.backgroundDisabled;
129+
if (game.backgroundDisabled) {canvas.style.display = 'none';}
130+
else {canvas.style.display = 'block';}
131+
}
132+
133+
function setBackgroundColors(a,b,c) {
134+
backgroundColor1 = a;
135+
backgroundColor2 = b;
136+
backgroundColor3 = c;
137+
}
138+
//setBackgroundColors([0.4,1,1],[0,0.2,0.2],[0.2,0,0.4]) //default
139+
//setBackgroundColors([0,1,1],[0,1,1],[0,0,1]) //blue
140+
//setBackgroundColors([1,1,0.4],[0.2,0.2,0],[0.4,0,0]) //Orange
141+
//setBackgroundColors([1.8,0,2],[0,0,1],[1,0,1])//Purple

constants.js

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
const XPButtonUnlockLevels = [0,2,3,6,10,15,20,30,40,60,90,150,200,300,400,Infinity];
2+
const XPButtonGains = [10,20,40,75,150,250,400,750,1200,1800,2400,4000,6000,9000,11500];
3+
const XPButtonCooldowns = [10,30,60,120,300,600,1200,2400,3600,5400,7200,14400,21600,32400,43200,Infinity];
4+
const XPButtonColors = ["#00ffff","#0080ff","#0000ff","#8000ff","#ff00ff","#ff0080","#ff0000","#ff8000","#ffff00","#80ff00","#00ff00","#00ff80"];
5+
6+
const chestButtonUnlockLevels = [0,3,5,10,20,50,100,200,300,500,750,1000,1500,2000,2500,3000,4000,5000,7500,10000,Infinity];
7+
const chestButtonCooldowns = [300, 600, 900, 1200, 1800, 2700, 3600, 5400, 5400, 5400, 5400, 5400, 5400, 5400, 5400, 5400, 5400, 5400, 5400, 5400];
8+
const rarityColors = ["#bbb", "#0e0", "#02f", "#c3f", "#fb0", "#f00", "#6cf", "#306", "#0a8", "#222", "#a08", "#f88", "#070", "#f80", "#0ff", "#fff", "#afa", "#00f", "#987", "#b00"];
9+
const rarityNames = ["common", "uncommon", "rare", "epic", "legendary", "mythical", "celestial", "void", "life", "infinite", "eternal", "rainbow", "verdant", "inferno", "frutiger", "anti", "mint", "vaporwave", "dust", "finality"];
10+
const rarityChances = [524288, 262144, 131072, 65536, 32768, 16384, 8192, 4096, 2048, 1024, 512, 256, 128, 64, 32, 16, 8, 4, 2, 1];
11+
/*
12+
const rarityChances = [
13+
[192,64, 32, 16, 8, 4, 2, 1], //Common chest
14+
[112,128,64, 24, 12, 6, 3, 1], //Uncommon chest
15+
[64, 128,96, 48, 16, 8, 4, 2], //Rare chest
16+
[48, 96, 128,72, 40, 16, 8, 4], //Epic chest
17+
[32, 64, 96, 128,80, 40, 16, 8], //Legendary chest
18+
[24, 48, 80, 112,112,72, 24, 12], //Mythical chest
19+
[16, 32, 64, 96, 128,96, 48, 16], //Celestial chest
20+
[8, 16, 32, 64, 96, 112,96, 48], //Void chest
21+
]*/
22+
const potionNames = ["tiny", "basic", "round", "triangular", "wide", "rotund", "large", "tall round", "tall triangular", "tall wide", "bulbous", "massive"];
23+
const potionChances = [15, 12, 9, 7, 5.5, 4, 3, 2.5, 2, 1.5, 1.2, 1];
24+
const potionXPGains = [0, 0.02, 0.04, 0.06, 0.08, 0.1, 0.12, 0.14, 0.16, 0.18, 0.2, 0.22, 0.5];
25+
const potionRarityXPMultipliers = [1, 1.5, 2, 2.5, 3, 3.5, 4, 5, 6.5, 8, 10, 15, 20, 30, 40, 50, 75, 100, 150, 200];
26+
27+
const romanNumerals = [
28+
["M", 1000],
29+
["CM", 900],
30+
["D", 500],
31+
["CD", 400],
32+
["C", 100],
33+
["XC", 90],
34+
["L", 50],
35+
["XL", 40],
36+
["X", 10],
37+
["IX", 9],
38+
["V", 5],
39+
["IV", 4],
40+
["I", 1]
41+
];
42+
43+
const ranks = [
44+
[1, "Beginner"],
45+
[2, "Basic"],
46+
[3, "Unremarkable"],
47+
[4, "Mediocre"],
48+
[5, "Average"],
49+
[6, "Competent"],
50+
[8, "Respectable"],
51+
[10, "Proficient"],
52+
[12, "Skilled"],
53+
[14, "Talented"],
54+
[16, "Expert"],
55+
[18, "Exceptional"],
56+
[20, "Brilliant"],
57+
[25, "Master"],
58+
[30, "Extraordinary"],
59+
[35, "Renowned"],
60+
[40, "Unmatched"],
61+
[45, "Superior"],
62+
[50, "Legendary"],
63+
[60, "Mythical"],
64+
[70, "Extreme"],
65+
[80, "Insane"],
66+
[90, "Supreme"],
67+
[100, "Immortal"],
68+
[120, "Celestial"],
69+
[140, "Galactic"],
70+
[160, "Godly"],
71+
[180, "Transcendent"],
72+
[200, "Cosmic"],
73+
[220, "Demonic"],
74+
[240, "Eternal"],
75+
[260, "Voidborn"],
76+
[280, "Universal"],
77+
[300, "Multiversal"],
78+
[350, "Omniversal"],
79+
[400, "Omnipotent"],
80+
[450, "Incomprehensible"],
81+
[500, "Infinite"],
82+
[550, "Infinite+"],
83+
[600, "Infinite++"],
84+
[650, "Infinite+++"],
85+
[700, "Infinite++++"],
86+
[750, "Infinite+++++"],
87+
[800, "Mega"],
88+
[850, "Mega+"],
89+
[900, "Mega++"],
90+
[950, "Mega+++"],
91+
[1000, "Mega++++"],
92+
[1050, "Mega+++++"],
93+
[1100, "Giga"],
94+
[1150, "Giga+"],
95+
[1200, "Giga++"],
96+
[1250, "Giga+++"],
97+
[1300, "Giga++++"],
98+
[1350, "Giga+++++"],
99+
[1400, "Tera"],
100+
[1450, "Tera+"],
101+
[1500, "Tera++"],
102+
[1550, "Tera+++"],
103+
[1600, "Tera++++"],
104+
[1650, "Tera+++++"],
105+
[1700, "Peta"],
106+
[1750, "Peta+"],
107+
[1800, "Peta++"],
108+
[1850, "Peta+++"],
109+
[1900, "Peta++++"],
110+
[1950, "Peta+++++"],
111+
[2000, "Omega"],
112+
[Infinity, "Error"],
113+
]

fonts/VCR_OSD_MONO.woff

22.9 KB
Binary file not shown.

fonts/alagard.woff

4.28 KB
Binary file not shown.

fonts/futura-Medium.woff

20.1 KB
Binary file not shown.

fonts/ms_sans_serif.woff

8.34 KB
Binary file not shown.

fonts/ms_sans_serif.woff2

6.36 KB
Binary file not shown.

fonts/ms_sans_serif_bold.woff

8.11 KB
Binary file not shown.

fonts/ms_sans_serif_bold.woff2

6.12 KB
Binary file not shown.

fonts/ms_sans_serif_mono.woff

8.57 KB
Binary file not shown.

0 commit comments

Comments
 (0)