Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Simulation keys (spacebar and dot/period key) now in accordance with …

…requirements
  • Loading branch information...
commit 6a7e8e43cd8068cbe963511122d8be276771e0f0 1 parent 587e653
@muraliavarma authored
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
17 murali_varma_hw2/build-tmp/source/murali_varma_hw2.java
@@ -34,6 +34,8 @@
final float VELOCITY_MATCHING_WEIGHT = 0.1f;
final float WANDERING_WEIGHT = 0.0002f;
+boolean isLoop = true;
+
int edgeBehavior = TOROIDAL_MODE;
int backgroundAlpha = 10; //0 for full trail, 255 for no trail
@@ -95,15 +97,18 @@ public void clearBackground() {
public void keyPressed() {
//simulation
- if (key == 'q') {
- noLoop();
+ if (key == ' ') {
+ isLoop = !isLoop;
}
- else if(key == 'w') {
+
+ if (isLoop) {
+ loop();
+ }
+
+ if(key == '.' || !isLoop) {
noLoop();
redraw();
- }
- else {
- loop();
+ isLoop = false;
}
//commands
View
17 murali_varma_hw2/murali_varma_hw2.pde
@@ -19,6 +19,8 @@ final float COLLISION_AVOIDANCE_WEIGHT = 0.001;
final float VELOCITY_MATCHING_WEIGHT = 0.1;
final float WANDERING_WEIGHT = 0.0002;
+boolean isLoop = true;
+
int edgeBehavior = TOROIDAL_MODE;
int backgroundAlpha = 10; //0 for full trail, 255 for no trail
@@ -80,15 +82,18 @@ void clearBackground() {
void keyPressed() {
//simulation
- if (key == 'q') {
- noLoop();
+ if (key == ' ') {
+ isLoop = !isLoop;
}
- else if(key == 'w') {
+
+ if (isLoop) {
+ loop();
+ }
+
+ if(key == '.' || !isLoop) {
noLoop();
redraw();
- }
- else {
- loop();
+ isLoop = false;
}
//commands
Please sign in to comment.
Something went wrong with that request. Please try again.