2019-01-14 12:14:14 +01:00
Citizen[] citizen = new Citizen[10];
2019-01-03 21:38:57 +01:00
2019-01-08 18:46:21 +01:00
//settings
2019-01-14 12:37:41 +01:00
boolean b_smallerImage = false; //use a cropped, smaller version of the 1920x1080 image for faster development
2019-01-04 10:12:38 +01:00
boolean b_loadSun = false; //load sun from web-api instead of local json file (local file is adressed to january 4th 2019. might implement a check that downloads today's information only once...
2019-01-08 21:04:54 +01:00
boolean b_drawNodes = false;
2019-01-08 22:00:30 +01:00
boolean b_drawPathLine = false;
2019-01-14 12:14:14 +01:00
boolean b_drawPathDestination = true;
boolean b_randomRun = false;
2019-01-08 18:46:21 +01:00
float f_nodeResolution = 0.2; //defines density of path-finding nodes, multiplied with resolution
2019-01-08 21:04:54 +01:00
int i_pathAlgorithm = 3;
2019-01-03 21:46:08 +01:00
2019-01-14 12:14:14 +01:00
void mousePressed() {
citizen[0].goTo(mouseX, mouseY);
2019-01-03 21:38:57 +01:00
}
2019-01-08 17:22:35 +01:00
2019-01-03 21:46:08 +01:00
void setup() {
2019-01-14 12:14:14 +01:00
size(1000, 1000);
2019-01-03 21:38:57 +01:00
fill(0);
2019-01-08 21:04:54 +01:00
blendMode(MULTIPLY);
if (b_smallerImage) img_houses = loadImage(dataPath("map/houses_with_borders_small.png"));
2019-01-04 08:23:33 +01:00
else img_houses = loadImage(dataPath("map/houses_with_borders.png"));
2019-01-08 21:04:54 +01:00
2019-01-03 21:46:08 +01:00
img_streets = loadImage(dataPath("map/streets.png"));
2019-01-14 20:40:20 +01:00
surface.setSize(img_houses.width, img_houses.height);
2019-01-08 21:04:54 +01:00
2019-01-04 08:23:33 +01:00
initHouses();
2019-01-08 17:22:35 +01:00
initPathFinding();
2019-01-04 10:12:38 +01:00
initWeather();
2019-01-14 20:40:20 +01:00
initCitizen();
2019-01-14 12:14:14 +01:00
2019-01-14 20:40:20 +01:00
}
2019-01-14 12:14:14 +01:00
2019-01-14 20:40:20 +01:00
void initCitizen(){
2019-01-14 12:14:14 +01:00
//namen: ethuriel, nathaniel, loriel, samuel, aluriel, aleriel, thaliel, suriel, kaliel,
citizen[0] = new Citizen(59, "Test");
2019-01-08 22:00:30 +01:00
citizen[1] = new Citizen(121, "Matze");
2019-01-08 21:04:54 +01:00
citizen[2] = new Citizen(18, "Freddy");
2019-01-08 22:00:30 +01:00
citizen[3] = new Citizen(59, "Korbi");
citizen[4] = new Citizen(121, "Lotte");
citizen[5] = new Citizen(18, "Reifi");
citizen[6] = new Citizen(59, "Grasso");
citizen[7] = new Citizen(121, "Nico");
citizen[8] = new Citizen(18, "Victor");
2019-01-14 12:14:14 +01:00
citizen[9] = new Citizen(59, "Paul");
2019-01-08 18:46:21 +01:00
2019-01-08 21:04:54 +01:00
for (int i = 0; i < citizen.length; i++) {
citizen[i].spawn(int(random(0, houses.size())));
2019-01-08 18:46:21 +01:00
}
2019-01-14 20:40:20 +01:00
//citizen[2].spawn(59);
2019-01-03 21:38:57 +01:00
}
2019-01-08 17:22:35 +01:00
2019-01-03 21:46:08 +01:00
void draw() {
2019-01-14 12:37:41 +01:00
//background(255);
background(img_houses);
2019-01-03 22:00:25 +01:00
//image(img_streets, 0, 0, img_houses.width, img_houses.height);
2019-01-14 12:37:41 +01:00
2019-01-03 21:46:08 +01:00
textSize(7);
2019-01-04 08:23:33 +01:00
textAlign(CENTER);
2019-01-14 12:37:41 +01:00
//for (House house : houses) {
// house.display();
//}
2019-01-08 21:04:54 +01:00
2019-01-14 12:14:14 +01:00
if (b_drawNodes) drawNodes();
2019-01-08 21:04:54 +01:00
for (int i = 0; i < citizen.length; i++) {
if (citizen[i].b_linked) {
citizen[i].update();
citizen[i].display();
}
2019-01-08 18:46:21 +01:00
}
2019-01-08 21:04:54 +01:00
2019-01-03 21:46:08 +01:00
UI();
2019-01-03 21:38:57 +01:00
}