changed pathalgo, implement per frame route finding

This commit is contained in:
2019-01-30 13:31:25 +01:00
parent e89d776eed
commit cf1268629f

View File

@@ -22,7 +22,7 @@ boolean b_drawNodes = false;
boolean b_housesTexts = false;
float f_nodeResolution = 0.2; //defines density of path-finding nodes, multiplied with resolution
int i_pathAlgorithm = 3;
int i_pathAlgorithm = 4;
int i_debugTextSize = 10;
int i_mapW, i_mapH;
int i_windowW, i_windowH;
@@ -71,11 +71,22 @@ void pre() {
}
String s_fromClient;
int i_mapLevelTransferC;
int i_makeThemGoC;
void draw() {
background(127);
clientCommunication();
if (b_makeThemGo) {
citizen[i_makeThemGoC].goTo(int(random(0, pg_map.width)), int(random(0, pg_map.height)), 10);
i_makeThemGoC ++;
if (i_makeThemGoC >= citizen.length) {
b_makeThemGo = false;
i_makeThemGoC = 0;
}
println(i_makeThemGoC);
}
pg_map.beginDraw();
pg_map.background(127);
@@ -100,14 +111,13 @@ void draw() {
for (int i = 0; i < citizen.length; i++) {
if (citizen[i].b_linked) {
citizen[i].update();
if (i != i_selectedCitizen)
citizen[i].display();
if (b_debug)
citizen[i].debug();
citizen[i].update();
if (i != i_selectedCitizen)
citizen[i].display();
if (b_debug)
citizen[i].debug();
}
}
if (b_controlEyeWithMouse) {
citizen[i_selectedCitizen].turnTo(citizen[i_selectedCitizen].f_xPos-(float)constrain(i_mapViewToMap(mouseX, i_mapOffsetX), 0, pg_map.width), citizen[i_selectedCitizen].f_yPos-(float)constrain(i_mapViewToMap(mouseY, i_mapOffsetY), 0, pg_map.height), 0) ;
}