From e74b25879583392365a015240ae77f69af90ae7a Mon Sep 17 00:00:00 2001 From: Fisch Date: Fri, 18 Jul 2025 23:02:37 +0200 Subject: [PATCH] improve spawning rate and separate behaviour for start and end wall --- src/main.cpp | 6 +++++- src/wagon.cpp | 30 ++++++++++++++++++------------ 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 74856e0..9988320 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -683,7 +683,11 @@ void loop_achterbahn(){ lastCheckspawn=loopmillis; Serial.print("Checking Spawning, wagons "); Serial.println(wagoncount); - if (random(0,SPAWNCHANCE)==0 && wagoncount=WRAPLEDENDPOS){ - #ifdef EDGE_WRAP + #ifdef EDGE_WRAP_END _pos-=WRAPLEDENDPOS; //Wrap around edges #endif - #ifdef EDGE_BOUNCE + #ifdef EDGE_BOUNCE_END _vel*=-1; //bounce at edges #endif - #ifdef EDGE_WALL + #ifdef EDGE_WALL_END //nothing #endif - #ifdef EDGE_KILL + #ifdef EDGE_KILL_END if (_pos>=WRAPLEDENDPOS+(_trainlength*WAGONLENGTH)){ _health=0; } #endif } if (_pos