Skip to content

Commit

Permalink
added resetGame()
Browse files Browse the repository at this point in the history
  • Loading branch information
beanieboi committed Dec 11, 2011
1 parent 1b294d3 commit 18dc1fc
Showing 1 changed file with 21 additions and 22 deletions.
43 changes: 21 additions & 22 deletions OccupyBullStreet.pde
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,6 @@ void setup() {
play = false;
neck_kinect = new PVector();
neck = new PVector();
students = new ArrayList();
studentCount = 2;
studentSpeed = 2;

fs = new FullScreen(this);
size(640, 480);

Expand All @@ -65,15 +61,10 @@ void setup() {
scoreBox = new ScoreBox();
readyBox = new ReadyBox();
minim = new Minim(this);
timer = new Timer(30000);
timer = new Timer(10000);
timerBox = new TimerBox(timer, minim);
level = 1;
protestersSong = minim.loadFile("protesters.mp3");


for (int i = 0; i <= studentCount-1; i++) {
students.add(new Student(minim, studentSpeed));
}
protestersSong = minim.loadFile("protesters.mp3");

// enable depthMap generation
if(usekinect) context.enableDepth();
Expand Down Expand Up @@ -147,6 +138,7 @@ void draw() {
}

student.draw();
student.update();
}

//draw bull
Expand All @@ -170,23 +162,32 @@ void draw() {
int userId = userList.get(i);
if(context.isTrackingSkeleton(userId)) {
playerId = userId;
timer.start();
protestersSong.loop();
}
}
}
}
}

update();
}

void update() {
roadBg.update();
void resetGame() {
students = new ArrayList();
studentCount = 2;
studentSpeed = 2;
level = 1;
roadBg.speed = 4.0;

for (int i = students.size()-1; i >= 0; i--) {
Student student = (Student) students.get(i);
student.update();
for (int i = 0; i <= studentCount-1; i++) {
students.add(new Student(minim, studentSpeed));
}

timer.start();
scoreBox.clear();
protestersSong.loop();
}

void update() {
roadBg.update();
}

// draw the skeleton with the selected joints
Expand Down Expand Up @@ -228,9 +229,7 @@ void keyPressed() {
}
break;
case ENTER:
timer.start();
scoreBox.clear();
protestersSong.loop();
resetGame();
play=true;
break;
}
Expand Down

0 comments on commit 18dc1fc

Please sign in to comment.