Skip to content
Browse files

Show/hide trail using the p key

  • Loading branch information...
1 parent 49aebb6 commit 5c0ae3a370ef7661d07e6d0f48a3782aed27f201 @muraliavarma committed Feb 6, 2013
View
BIN murali_varma_hw2/build-tmp/murali_varma_hw2$Creature.class
Binary file not shown.
View
BIN murali_varma_hw2/build-tmp/murali_varma_hw2.class
Binary file not shown.
View
13 murali_varma_hw2/build-tmp/source/murali_varma_hw2.java
@@ -35,7 +35,7 @@
final float WANDERING_WEIGHT = 0.0002f;
int edgeBehavior = TOROIDAL_MODE;
-int backgroundAlpha = 20; //0 for full trail, 255 for no trail
+int backgroundAlpha = 10; //0 for full trail, 255 for no trail
//flock centering, velocity matching, collision avoidance, wandering force
boolean flockCenteringForce = true;
@@ -106,6 +106,17 @@ else if(key == 'w') {
}
}
+ if (key == 'p') {
+ if (backgroundAlpha == 255) {
+ //if no trail, make it full trail
+ backgroundAlpha = 0;
+ }
+ else {
+ //if some trail (between 1 and 254), make it no trail
+ backgroundAlpha = 255;
+ }
+ }
+
//forces
if (key == '1') {
flockCenteringForce = !flockCenteringForce;
View
13 murali_varma_hw2/murali_varma_hw2.pde
@@ -20,7 +20,7 @@ final float VELOCITY_MATCHING_WEIGHT = 0.1;
final float WANDERING_WEIGHT = 0.0002;
int edgeBehavior = TOROIDAL_MODE;
-int backgroundAlpha = 20; //0 for full trail, 255 for no trail
+int backgroundAlpha = 10; //0 for full trail, 255 for no trail
//flock centering, velocity matching, collision avoidance, wandering force
boolean flockCenteringForce = true;
@@ -91,6 +91,17 @@ void keyPressed() {
}
}
+ if (key == 'p') {
+ if (backgroundAlpha == 255) {
+ //if no trail, make it full trail
+ backgroundAlpha = 0;
+ }
+ else {
+ //if some trail (between 1 and 254), make it no trail
+ backgroundAlpha = 255;
+ }
+ }
+
//forces
if (key == '1') {
flockCenteringForce = !flockCenteringForce;

0 comments on commit 5c0ae3a

Please sign in to comment.
Something went wrong with that request. Please try again.