Files
citizen/citizen.pde

79 lines
2.1 KiB
Plaintext

Citizen[] citizen = new Citizen[10];
//settings
boolean b_smallerImage = true; //use a cropped, smaller version of the 1920x1080 image for faster development
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...
boolean b_drawNodes = false;
boolean b_drawPathLine = false;
boolean b_drawPathDestination = true;
boolean b_randomRun = false;
float f_nodeResolution = 0.2; //defines density of path-finding nodes, multiplied with resolution
int i_pathAlgorithm = 3;
void mousePressed() {
citizen[0].goTo(mouseX, mouseY);
}
void setup() {
size(1000, 1000);
fill(0);
blendMode(MULTIPLY);
if (b_smallerImage) img_houses = loadImage(dataPath("map/houses_with_borders_small.png"));
else img_houses = loadImage(dataPath("map/houses_with_borders.png"));
img_streets = loadImage(dataPath("map/streets.png"));
initHouses();
initPathFinding();
initWeather();
surface.setSize(img_houses.width, img_houses.height);
//namen: ethuriel, nathaniel, loriel, samuel, aluriel, aleriel, thaliel, suriel, kaliel,
citizen[0] = new Citizen(59, "Test");
citizen[1] = new Citizen(121, "Matze");
citizen[2] = new Citizen(18, "Freddy");
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");
citizen[9] = new Citizen(59, "Paul");
for (int i = 0; i < citizen.length; i++) {
citizen[i].spawn(int(random(0, houses.size())));
}
//citizen[2].spawn(59);
}
void draw() {
background(255);
image(img_houses, 0, 0, img_houses.width, img_houses.height);
//image(img_streets, 0, 0, img_houses.width, img_houses.height);
textSize(7);
textAlign(CENTER);
for (House house : houses) {
house.display();
}
if (b_drawNodes) drawNodes();
for (int i = 0; i < citizen.length; i++) {
if (citizen[i].b_linked) {
citizen[i].update();
citizen[i].display();
}
}
UI();
}