Research On StopWatch

This morning I did some research into how I could get the stop watch that we plan to have in DoodleBlocks working in a way that it starts at 0, and finishes at 30. We plan to give the user 30 seconds to sketch out there drawing. We want to have a “human against the clock” type of feeling in this game. I had a huge success with the stop watch this morning which I was very happy about. Below is the code I used to get the stop watch working. I used processing to get this working and I think processing is such a great piece of software because it is alot more easier to work compared to using Flash.

StopWatchTimer sw;

void setup() {
size(400, 400);
println (millis());
sw = new StopWatchTimer();
sw.start();
}
void draw () {
time();
}

void time() {
background(#FFFFFF);
fill(#000000);
textAlign(CENTER);

// text(“:”, 200, 175);
// text(hour(), 150, 175);
text(nf(sw.hour(), 2)+”:”+nf(sw.minute(), 2)+”:”+nf(sw.second(), 2), 150, 175);
}

class StopWatchTimer {
int startTime = 0, stopTime = 10;
boolean running = false;
void start() {
startTime = millis();
running = true;
}
void stop() {
stopTime = millis();
running = false;
}
int getElapsedTime() {
int elapsed;
if (running) {
elapsed = (millis() – startTime);
}
else {
elapsed = (stopTime – startTime);
}
return elapsed;
}
int second() {
return (getElapsedTime() / 1000) % 60;
}
int minute() {
return (getElapsedTime() / (1000*60)) % 60;
}
int hour() {
return (getElapsedTime() / (1000*60*60)) % 24;
}
}

Screen shot 2014-11-17 at 09.33.28The next piece of software that I plan to experiment withis called Reactivision. We plan to use Reactivision by incorporating a selection of colour brushes into the game. We hope to use the cubes that are related to reactivision below to let the user select a type of colour that they would like.

Screen shot 2014-11-17 at 09.52.30If you hold those images up to the screen of the computer they will take control and you can make certain changes on screen if programmed correctly. Things are really going in the right direction.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s