please format code with </> button * homework policy * asking questions
Hello. I have been working on a game very well but after time my biggest issue became the bad fps in my game. I have tried using threads to somehow solve my problem. The fps issue is solved when I thread the refresh() function. But then everything is being moved weirdly and chaos happens on my screen. Then I tried running the refresh function without a thread. The chaos problem was solved but then the fps problem faces me again. Can someone please help me? I have no experience and knowledge using the gpu. Thank you very much
if (playing == true) {
if (Pause == false) {
println(frameRate);
//thread("testLol");
//image(hpBoss, xhpBoss, yhpBoss - height/4.5176, height/15.36, height/15.36); //hpBossIcon
//image(hpPlayer, xhpPlayer, yhpPlayer - height/4.5176, height/15.36, height/15.36); //hpPlayerIcon
//imageMode(CORNER);
//rect(xHPIcon, yHPIcon - height/4.5176, bHPIcon, hHPIcon);
//rectMode(CORNER);
/*imageMode(CENTER);
image(pfeilButtonLinks,height/9.6,height/1.11304,height/5.12,height/5.12);
image(pfeilButtonRechts,height/3.072,height/1.11304,height/5.12,height/5.12);
image(attackButton,height/0.60235,height/1.11304,height/5.12,height/5.12);
image(blockButton,height/0.69818,height/1.11304,height/5.12,height/5.12);
image(skill1Button,height/0.83027,height/1.11304,height/5.12,height/5.12);
image(skill2Button,height/0.83027,height/1.44905,height/5.12,height/5.12);*/
//imageMode(CORNER);
//fill(0, 130, 0);
//rect(xPlayerHP, yPlayerHP - height/4.5176, height/3.072, height/10.9714); //PlayerHP refresh
//fill(0, 255, 0);
//rect(xPlayerHP, yPlayerHP - height/4.5176, sPlayerHP, height/10.9714); //PlayerHP
//rectMode(CORNER);
//fill(0);
//rect(width-height/4.11157, height/5.23684, height/4.145833, height/13.266666); //timer Refresh
//fill(130, 0, 0);
//rect(width-height/2.50177, height/1.1814999 - height/4.5176, height/3.076154, height/10.96769); //BossHP refresh
//fill(255, 0, 0);
//rectMode(CORNERS);
//rect(xBossHP1, yBossHP1 - height/4.5176, xBossHP2, yBossHP2 - height/4.5176); //BossHP
//rectMode(CENTER);
thread("startCdTimerSun1");
thread("startCdTimerSun2");
thread("spielerBewegen");
thread("bossBewegen");
thread("aktiviereMoonFormen");
thread("formenLinksRechts");
thread("playerSlash");
thread("playerBlocking");
thread("defeat");
thread("victory");
thread("runThroughWall");
thread("playerSlashCD");
thread("loseHPTouching");
//m.moonBreathing1stForm();
//m.moonBreathing3rdForm();
//p.playerAttack();
thread("bossIsOnFire");
//s.sunBreathing2ndForm();
//sunBreathing();
thread("timer");
refresh();
}
pause();
//1920x1080
}
void refresh() {
rectMode(CENTER);
fill(0);
rectMode(CENTER);
rect(xBoss, yBoss, bSize+height/6.144, bSize); //refresh Boss
rectMode(CENTER);
rect(xPlayer, yPlayer, pSize + height/6.144, pSize); //Spieler refresh
imageMode(CENTER);
image(playerStay[load1TimeIMGp], xPlayer, yPlayer, pSize, pSize); //Spieler
imageMode(CENTER);
image(bossStay[load1TimeIMGb], xBoss, yBoss, bSize, bSize); //Boss
imageMode(CENTER);
image(hpBoss, xhpBoss, yhpBoss - height/4.5176, height/15.36, height/15.36); //hpBossIcon
imageMode(CENTER);
image(hpPlayer, xhpPlayer, yhpPlayer - height/4.5176, height/15.36, height/15.36); //hpPlayerIcon
rectMode(CORNER);
fill(0);
rectMode(CORNER);
rect(width-height/4.11157, height/5.23684, height/4.145833, height/13.266666); //timer Refresh
imageMode(CORNER);
image(cdZahlen[timerImages1], width - height/9.95, height/6.0472, height/7.68, height/7.68);
imageMode(CORNER);
image(cdZahlen[timerImages2], width - height/6.21875, height/6.0472, height/7.68, height/7.68);
imageMode(CORNER);
image(cdZahlen[timerImages3], width - height/3.82692, height/6.0472, height/7.68, height/7.68);
imageMode(CORNER);
image(doppelPunkt, width-height/4.975, height/5.527777, height/9.47619, height/9.95);
fill(130, 0, 0);
rect(width-height/2.50177, height/1.1814999 - height/4.5176, height/3.076154, height/10.96769); //BossHP refresh
fill(0, 130, 0);
rect(xPlayerHP, yPlayerHP - height/4.5176, height/3.072, height/10.9714); //PlayerHP refresh
fill(0, 255, 0);
rect(xPlayerHP, yPlayerHP - height/4.5176, sPlayerHP, height/10.9714); //PlayerHP
rectMode(CORNERS);
fill(255, 0, 0);
rect(xBossHP1, yBossHP1 - height/4.5176, xBossHP2, yBossHP2 - height/4.5176); //BossHP
imageMode(CORNER);
rectMode(CORNER);
fill(0);
rect(height/2.4774, height/3.072, height/7.68, height/12.8);
rect(height/2.4774, height/4.2666, height/7.68, height/12.8);
image(cdZahlen[i1], height/3.0117, height/3.8984, height/7.68, height/7.68);
image(cdZahlen[i2], height/3.0117, height/6.0472, height/7.68, height/7.68);
image(skill1CD, height/76.8, height/3.6571, height/3.072, height/9.6);
image(skill2CD, height/76.8, height/5.48571, height/3.072, height/9.6);
}