From 2b1f590321d059fbd15bef2312f621b3b6c839e2 Mon Sep 17 00:00:00 2001 From: SvenWhy Date: Sat, 2 Nov 2024 14:26:37 +0100 Subject: [PATCH 1/2] toggle instead of hover to select spiders this makes it less laggy because when you select a spider it lags so it isnt accidental anymore and it makes it easier to select spiders at higher speeds --- SpiderEvoSim.pde | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/SpiderEvoSim.pde b/SpiderEvoSim.pde index c0b8850..670731f 100644 --- a/SpiderEvoSim.pde +++ b/SpiderEvoSim.pde @@ -164,18 +164,21 @@ void checkHighlight(){ highlight_spider = checkHighlightHelper(); } } -Spider checkHighlightHelper(){ +Spider checkHighlightHelper() { Spider answer = null; float recordLowest = 1; - for(int s = 0; s < spiders.size(); s++){ - float score = spiders.get(s).cursorOnSpider(); - if(score > 0 && score < recordLowest){ - recordLowest = score; - answer = spiders.get(s); + if (mousePressed) { + for (int s = 0; s < spiders.size(); s++) { + float score = spiders.get(s).cursorOnSpider(); + if (score > 0 && score < recordLowest) { + recordLowest = score; + answer = spiders.get(s); + } } } return answer; } + void drawUI(){ noStroke(); fill(0); From 58639a52a2fd13c12641a1522a57ad7d1575d060 Mon Sep 17 00:00:00 2001 From: SvenWhy Date: Sat, 2 Nov 2024 16:36:49 +0100 Subject: [PATCH 2/2] camera clamp now the camera clamps so the camera cant go upside down --- SpiderEvoSim.pde | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/SpiderEvoSim.pde b/SpiderEvoSim.pde index 670731f..4656615 100644 --- a/SpiderEvoSim.pde +++ b/SpiderEvoSim.pde @@ -151,13 +151,19 @@ void setup(){ r.setPointerVisible(false); g = createGraphics(1920,1080,P3D); } -void draw(){ - doMouse(); - doPhysics(); - drawVisuals(); - image(g,0,0); - drawUI(); - frames++; +void draw() { + doMouse(); + doPhysics(); + drawVisuals(); + image(g, 0, 0); + drawUI(); + frames++; + if (camera[1] < -1) { + camera[1] = -1; + } + if (camera[1] > 1) { + camera[1] = 1; + } } void checkHighlight(){ if(!lock_highlight){