Files
citizen/citizen.pde

92 lines
2.3 KiB
Plaintext
Raw Normal View History

2019-01-03 22:00:25 +01:00
Citizen mensch;
2019-01-03 21:38:57 +01:00
2019-01-04 08:56:39 +01:00
//debug settings
2019-01-04 10:12:38 +01:00
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...
2019-01-03 21:46:08 +01:00
2019-01-04 08:56:39 +01:00
void mouseClicked(){
2019-01-04 10:50:14 +01:00
mensch.goTo(112);
2019-01-04 08:56:39 +01:00
}
2019-01-03 21:38:57 +01:00
class Citizen{
2019-01-04 08:56:39 +01:00
int i_xSpawn, i_ySpawn, i_xPos, i_yPos, i_diameter;
boolean b_linked;
int i_home;
2019-01-04 10:50:14 +01:00
String S_name;
2019-01-04 08:56:39 +01:00
// berufsfeld: webdesigner, pädagoge, schmuckdesigner, schmied
// berufsstatus: beamter, selbstständiger, unternehmer, angestellter, grundschüler, gymnasiast, hauptschüler, realschüler, azubi, student, rentner
// identität: gelbhemd, lokal, regional, national, international, fremd,
2019-01-04 10:12:38 +01:00
//names of pathfinding algorithms: greedy best first search, uniform cost search, a star search
2019-01-04 10:50:14 +01:00
Citizen(int home, String name){
2019-01-04 08:56:39 +01:00
i_home = home;
2019-01-04 10:50:14 +01:00
S_name = name;
2019-01-04 08:56:39 +01:00
i_diameter = 15;
}
2019-01-03 21:38:57 +01:00
2019-01-04 08:56:39 +01:00
void goTo(int house){
println("want to go to house " + house);
2019-01-03 21:38:57 +01:00
}
2019-01-04 08:56:39 +01:00
void spawn(int house){
PVector v2_spawnPoint = spawnAreas.get(house).v2_randomSpawnPoint();
i_xSpawn = int(v2_spawnPoint.x);
i_ySpawn = int(v2_spawnPoint.y);
2019-01-03 21:38:57 +01:00
i_xPos = i_xSpawn;
i_yPos = i_ySpawn;
2019-01-04 08:56:39 +01:00
b_linked = true;
2019-01-03 21:38:57 +01:00
}
2019-01-04 08:56:39 +01:00
void despawn(){
b_linked = false;
2019-01-03 21:38:57 +01:00
}
2019-01-04 08:56:39 +01:00
2019-01-03 21:38:57 +01:00
void display(){
2019-01-04 08:56:39 +01:00
ellipse(i_xPos, i_yPos, i_diameter, i_diameter);
2019-01-04 10:50:14 +01:00
textSize(10);
text(S_name, i_xPos, i_yPos-10);
2019-01-03 21:38:57 +01:00
}
}
2019-01-03 21:46:08 +01:00
void setup() {
size(400, 300);
2019-01-03 21:38:57 +01:00
fill(0);
2019-01-04 08:56:39 +01:00
//ft = new SimpleDateFormat ("HH:mm:ss");
2019-01-03 21:38:57 +01:00
2019-01-04 10:12:38 +01:00
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-03 21:38:57 +01:00
2019-01-03 21:46:08 +01:00
img_streets = loadImage(dataPath("map/streets.png"));
2019-01-04 08:23:33 +01:00
initHouses();
2019-01-03 21:38:57 +01:00
blendMode(MULTIPLY);
2019-01-03 21:46:08 +01:00
surface.setSize(img_houses.width, img_houses.height);
2019-01-03 21:38:57 +01:00
2019-01-04 10:12:38 +01:00
initWeather();
2019-01-03 21:38:57 +01:00
2019-01-04 10:50:14 +01:00
mensch = new Citizen(59, "Pe");
mensch.spawn(59);
2019-01-03 21:38:57 +01:00
}
2019-01-03 21:46:08 +01:00
void draw() {
background(255);
image(img_houses, 0, 0, img_houses.width, img_houses.height);
2019-01-03 22:00:25 +01:00
//image(img_streets, 0, 0, img_houses.width, img_houses.height);
2019-01-03 21:46:08 +01:00
textSize(7);
2019-01-04 08:23:33 +01:00
textAlign(CENTER);
2019-01-03 21:46:08 +01:00
for (SpawnArea spawn : spawnAreas) {
spawn.display();
2019-01-03 21:38:57 +01:00
}
2019-01-04 08:56:39 +01:00
mensch.display();
2019-01-03 21:46:08 +01:00
UI();
2019-01-03 21:38:57 +01:00
}