Skip to content
This repository has been archived by the owner on Nov 7, 2019. It is now read-only.

Commit

Permalink
last version running (scanning color updated, interaction finalize)
Browse files Browse the repository at this point in the history
  • Loading branch information
agrignard committed Nov 26, 2018
1 parent aa43e29 commit e1c01c8
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 23 deletions.
26 changes: 20 additions & 6 deletions ABMobility/Agent.pde
Original file line number Diff line number Diff line change
Expand Up @@ -195,17 +195,24 @@ public class Agent {
p.fill(#FFFFFF);
p.stroke(#FFFFFF);
}
p.fill(myColor);
p.stroke(myColor);
p.ellipse(pos.x, pos.y, 10*SCALE, 10*SCALE);
PImage img = glyph[0];
if (img != null) {
p.pushMatrix();
p.translate(pos.x, pos.y);
p.rotate(dir.heading() + PI * 0.5);
p.translate(-1, 0);
p.image(img, 0, 0, img.width * SCALE, img.height * SCALE);
p.popMatrix();
}
if(showConnectionBetweenAgentAndBuilding){
p.stroke(myColor,100);
p.strokeWeight(1);
p.line(pos.x, pos.y, universe.grid.gridAnimation.get(universe.grid.currentGridAnimated).center.x, universe.grid.gridAnimation.get(universe.grid.currentGridAnimated).center.y);
p.noStroke();
}
}
} else {

}
if (pos == null || path == null) { // in zombie land.
return;
}
Expand All @@ -216,7 +223,14 @@ public class Agent {
p.translate(pos.x, pos.y);
p.rotate(dir.heading() + PI * 0.5);
p.translate(-1, 0);
p.image(img, 0, 0, img.width * SCALE, img.height * SCALE);
if (showRemaninginAgentAndBuilding){
p.tint(255,60);
p.image(img, 0, 0, img.width * SCALE, img.height * SCALE);
p.tint(255,255);
}else{
p.tint(255,255);
p.image(img, 0, 0, img.width * SCALE, img.height * SCALE);
}
p.popMatrix();
}
} else {
Expand All @@ -242,7 +256,7 @@ public class Agent {
}
}
}
}

}

// DRAW AGENT PATH TO DESTINATION --->
Expand Down
2 changes: 1 addition & 1 deletion ABMobility/Building.pde
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class Building {
public void draw (PGraphics p) {
p.fill(universe.grid.gridQRcolorMap.get(loc));
p.stroke(#000000);
p.rect (loc.x*GRID_CELL_SIZE+size/2, loc.y*GRID_CELL_SIZE+size/2, size*0.9, size*0.9);
p.rect (loc.x*GRID_CELL_SIZE+size/2, loc.y*GRID_CELL_SIZE+size/2, size*0.8, size*0.8);
if (devMode) {
p.textAlign(CENTER);
p.textSize(20*SCALE);
Expand Down
10 changes: 5 additions & 5 deletions ABMobility/Grid.pde
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ public class Grid {
gridQRcolorMap.put(gridMap.get(4), #888888);
gridQRcolorMap.put(gridMap.get(5), #888888);
gridQRcolorMap.put(gridMap.get(6), #888888);
gridQRcolorMap.put(gridMap.get(7), #666666);
gridQRcolorMap.put(gridMap.get(7), #888888);
gridQRcolorMap.put(gridMap.get(8), #CCCCCC);
gridQRcolorMap.put(gridMap.get(9), #CCCCCC);
gridQRcolorMap.put(gridMap.get(10), #666666);
gridQRcolorMap.put(gridMap.get(10), #999999);
gridQRcolorMap.put(gridMap.get(11), #888888);
gridQRcolorMap.put(gridMap.get(12), #888888);
gridQRcolorMap.put(gridMap.get(13), #666666);
gridQRcolorMap.put(gridMap.get(13), #888888);
gridQRcolorMap.put(gridMap.get(14), #CCCCCC);
gridQRcolorMap.put(gridMap.get(15), #CCCCCC);
gridQRcolorMap.put(gridMap.get(16), #777777);
Expand Down Expand Up @@ -112,7 +112,7 @@ public class Grid {
b.draw(p);
}
}
// Draw building block locations
// Draw building block locations (this is redundant with the b.draw(p) but it's to be sure to display the -1 block)
drawBuildingBlocks(p);
}

Expand All @@ -125,7 +125,7 @@ public class Grid {
PVector loc = gridMap.get(i);
p.fill(universe.grid.gridQRcolorMap.get(loc));
p.stroke(universe.grid.gridQRcolorMap.get(loc));
p.rect(loc.x*GRID_CELL_SIZE+BUILDING_SIZE/2, loc.y*GRID_CELL_SIZE+BUILDING_SIZE/2, BUILDING_SIZE*0.9, BUILDING_SIZE*0.9);
p.rect(loc.x*GRID_CELL_SIZE+BUILDING_SIZE/2, loc.y*GRID_CELL_SIZE+BUILDING_SIZE/2, BUILDING_SIZE*0.8, BUILDING_SIZE*0.8);
}
}

Expand Down
4 changes: 3 additions & 1 deletion ABMobility/GridInteractionAnimation.pde
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,12 @@ public class GridInteractionAnimation {
if (isPut == false) {
showConnectionBetweenAgentAndBuilding = true;
showRemaninginAgentAndBuilding = true;
if(t<0.2){
dynamicSquare(p, pow(t, t), #FFFFFF);
}
if(t>0.4){
showConnectionBetweenAgentAndBuilding = false;
}
dynamicSquare(p, pow(t, t), #FFFFFF);
}

if (t < 0 || t > 1) {
Expand Down
20 changes: 10 additions & 10 deletions ABMobility/keystone.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<keystone>
<surface h="1330" res="50" w="1064" x="5278.0" y="263.0">
<point i="0" u="0.0" v="0.0" x="970.0" y="-203.0"/>
<point i="50" u="532.0" v="0.0" x="877.0" y="777.0"/>
<point i="2550" u="0.0" v="665.0" x="-471.0" y="-221.0"/>
<point i="2600" u="532.0" v="665.0" x="-412.0" y="770.0"/>
<surface h="1330" res="50" w="1064" x="5286.0" y="459.0">
<point i="0" u="0.0" v="0.0" x="956.0" y="-396.0"/>
<point i="50" u="532.0" v="0.0" x="880.0" y="592.0"/>
<point i="2550" u="0.0" v="665.0" x="-466.0" y="-401.0"/>
<point i="2600" u="532.0" v="665.0" x="-410.0" y="551.0"/>
</surface>
<surface h="1330" res="50" w="1064" x="3380.0" y="101.0">
<point i="0" u="0.0" v="0.0" x="-450.0" y="878.0"/>
<point i="50" u="532.0" v="0.0" x="-592.0" y="-72.0"/>
<point i="2550" u="0.0" v="665.0" x="730.0" y="847.0"/>
<point i="2600" u="532.0" v="665.0" x="839.0" y="-112.0"/>
<surface h="1330" res="50" w="1064" x="3338.0" y="129.0">
<point i="0" u="0.0" v="0.0" x="-371.0" y="873.0"/>
<point i="50" u="532.0" v="0.0" x="-476.0" y="-48.0"/>
<point i="2550" u="0.0" v="665.0" x="793.0" y="909.0"/>
<point i="2600" u="532.0" v="665.0" x="938.0" y="-18.0"/>
</surface>
</keystone>

0 comments on commit e1c01c8

Please sign in to comment.