Use your mouse to interact with the buttons. The + button increments your points.
xxxxxxxxxx
let ambi;
function preload() {
font = loadFont('SomeTypeMono.ttf');
soundFormats('mp3');
ambi = loadSound('Surreal');
}
let introBG;
let isInIntro = true;
let tabDiv = 2; // 2
let tabbedSection;
let mainClicker;
let deltaTick = 0;
function setup() {
createCanvas(windowWidth, windowHeight);
textFont(font);
gameInit();
}
function resetCurrencies() {
storeItem('c_main', 0);
storeItem('c_gear', 0);
storeItem('c_pro', 0);
storeItem('c_trans', 0);
storeItem('c_cons', 0);
retrieveCurrencies();
gameInit();
}
function retrieveCurrencies() {
setCVal(0);
if (getItem('c_main') !== null) {
setCVal(getItem('c_main'))
}
setCVal(0, 'gear');
if (getItem('c_gear') !== null) {
setCVal(getItem('c_gear'), 'gear');
}
setCVal(0, 'pro');
if (getItem('c_pro') !== null) {
setCVal(getItem('c_pro'), 'pro');
}
setCVal(0, 'trans');
if (getItem('c_trans') !== null) {
setCVal(getItem('c_trans'), 'trans');
}
setCVal(0, 'cons');
if (getItem('c_cons') !== null) {
setCVal(getItem('c_cons'), 'cons');
}
}
function saveCurrencies() {
storeItem('c_main', getCVal());
storeItem('c_gear', getCVal('gear'));
storeItem('c_pro', getCVal('pro'));
storeItem('c_trans', getCVal('trans'));
storeItem('c_cons', getCVal('cons'));
}
function gameInit() {
introBG = 200;
background(introBG);
ambi.stop();
ambi.loop();
mainClicker = new Clicker(width / 2, 75, '+', function() {
incCVal();
}, 40, color(255));
initialiseSections();
retrieveCurrencies();
}
function renderTopText() {
fill(255);
textAlign(CENTER, TOP);
textSize(24);
text("You have " + getCVal() + " points", width / tabDiv, 4);
fill(180);
textSize(16);
text("(" + getCPPS() + " points per second and " + getCPPC() + " points per click)", width / tabDiv, 30);
}
function renderBottomText() {
fill(255);
textAlign(CENTER, BOTTOM);
textSize(24);
text("The Curve by Blaster003, forked by no one!", width / tabDiv, height - 4);
fill(180);
textSize(16);
text("(v0.0.1 - Start of a game)", width / tabDiv, height - 30);
}
function drawLines(x, y, lines) {
stroke(255);
strokeWeight(3);
for (var connection in lines) {
connection = lines[connection];
connected = sections[connection[0]][connection[1]];
line(x, y, connected.x(sections[connection[0]].length, connection[1]), connected.y(sections.length));
}
}
function calcMaxLayer() {
for (let layer = sections.length - 1; layer > 0; layer--) {
for (var section in sections[layer]) {
if (sections[layer][section].isUnlocked()) {
return layer + 1;
}
}
}
return 1;
}
function draw() {
background(introBG);
renderTopText();
renderBottomText()
introBG = lerp(introBG, 20, 0.018);
// clicker
mainClicker.update();
for (var layer in sections) {
layer = sections[layer];
for (var section in layer) {
thisSection = layer[section];
if (thisSection.isUnlocked())
drawLines(thisSection.x(layer.length, section), thisSection.y(calcMaxLayer()), thisSection.linesTo);
}
}
for (var layer2 in sections) {
layer2 = sections[layer2];
for (var section2 in layer2) {
if (layer2[section2].isUnlocked())
layer2[section2].update(layer2.length, calcMaxLayer(), section2);
}
}
if (tabbedSection) {
sections[tabbedSection[0]][tabbedSection[1]].updateTab();
}
// pps
if (getCPPS() < frameRate() && getCPPS()) {
if (BigInt(round(deltaTick)) >= BigInt(1000) / getCPPS()) {
addCVal(1);
deltaTick = 0;
}
} else {
addCVal(BigInt(round(deltaTime)) * getCPPS() / BigInt(1000));
}
saveCurrencies();
deltaTick += deltaTime;
}
let resetThingy = false;
function keyTyped() {
if (key === 'r') {
if (resetThingy) {
resetThingy = false;
resetCurrencies();
print('[RESET] Reset!');
} else {
print('[RESET] Are you sure? Press R again to confirm or Q to exit out of this dialogue.');
resetThingy = true;
}
}
if (key === 'q') {
if (resetThingy) {
resetThingy = false;
print('[RESET] No reset done!');
}
}
}