00:00
00:00
B1KMusic
Hi. I make games and software. I'm not on NG much, but feel free to peruse my youtube and gitlab for interesting stuff.

Braden @B1KMusic

Age 29, Male

Programmer/Musician/

fish

Earth, Milky Way

Joined on 6/19/11

Level:
10
Exp Points:
948 / 1,110
Exp Rank:
69,466
Vote Power:
5.20 votes
Rank:
Police Sergeant
Global Rank:
8,625
Blams:
42
Saves:
1,040
B/P Bonus:
12%
Whistle:
Normal
Medals:
799

Advanced 3D Digital Clock!

Posted by B1KMusic - August 19th, 2011


here it is, the final version of the clock, a project which took a solid 8 hours of (on computer) work to complete ;)

I spent a good three days figuring out how to actually DRAW the 7-seg display on graph paper, with different variations, such as 3D, 2D, and with a shadow, I learned that a basic 7-seg can be made with a 3X5 grid, all you do is draw slashes in the corners and X's in the sides* (with pencil) and then draw the shape of the number, again, with pencil. After the shape has been made, carefully trace over the lines with an ink pen, then erase the pencil marks, viola!

*Looks kinda like this:

\_/
X_X
/_\
Features:

*Pays tribute to the famous 7-segment display you see every morning

*Will reliably tell you the time at 12 fps (uses your computer's time, so fps isn't a concern)

*Scrolling to the right by prressing the right arrow key or D (for you W,A,S,D users :P) shows the current seconds

*3 fuckin D!

*and more...

100%, all, of the content in this flash was made by yours truly (me) :D

I made a digital clock, but by using movie clips instead of a text field, so naturally, this is a lot more tedious.

In this, the latest version, I drew the 7-segment display in 3 dimensions, and included seconds and a scrolling feature so the flash isn't long as shit :)

//init
n1.gotoAndStop("n8");
n2.gotoAndStop("n8");
n3.gotoAndStop("n8");
n4.gotoAndStop("n8");
n5.gotoAndStop("n8");
n6.gotoAndStop("n8");
//end init
//The above lines initialize the clips to play at the frame "n8" (number 8), and you will see it briefly
ch = createEmptyMovieClip("c", 1);
ch.lineTo(800, 320);
CAM = new VCam(ch);
ch._y = 180;
ch._x = 390;
//830
//390
//the above script creates a camera, for this, you need the VCam.as I posted about earlier
onEnterFrame = function () {
if (Key.isDown(Key.RIGHT) && ch._x<=830 || Key.isDown(key.D) && ch._x<=830) {
ch._x += 160;
} else if (Key.isDown(Key.LEFT) && ch._x>=390 || Key.isDown(key.A) && ch._x>=390) {
ch._x -= 160;
}
if (ch._x<390) {
ch._x = 390;
} else if (ch._x>830) {
ch._x = 830;
}
//the most complex part; I had to revise and revise to get the right coordinates, trace() is your friend
//here :)
now = new Date();
h = now.getHours();
m = now.getMinutes();
s = now.getSeconds();
//creates the hour, minute, and second variables (OOP classes, learn em!)
//hours
if (h == 0 || h == 12) {
n1.gotoAndStop("n1");
n2.gotoAndStop("n2");
block._visible = false
} else if (h == 1 || h == 13) {
n1.gotoAndStop("n0");
n2.gotoAndStop("n1");
block._visible = true
} else if (h == 2 || h == 14) {
n1.gotoAndStop("n0");
n2.gotoAndStop("n2");
block._visible = true
} else if (h == 3 || h == 15) {
n1.gotoAndStop("n0");
n2.gotoAndStop("n3");
block._visible = true
} else if (h == 4 || h == 16) {
n1.gotoAndStop('n0');
n2.gotoAndStop('n4');
block._visible = true
} else if (h == 5 || h == 17) {
n1.gotoAndStop('n0');
n2.gotoAndStop('n5');
block._visible = true
} else if (h == 6 || h == 18) {
n1.gotoAndStop('n0');
n2.gotoAndStop('n6');
block._visible = true
} else if (h == 7 || h == 19) {
n1.gotoAndStop('n0');
n2.gotoAndStop('n7');
block._visible = true
} else if (h == 8 || h == 20) {
n1.gotoAndStop('n0');
n2.gotoAndStop('n8');
block._visible = true
} else if (h == 9 || h == 21) {
n1.gotoAndStop('n0');
n2.gotoAndStop('n9');
block._visible = true
} else if (h == 10 || h == 22) {
n1.gotoAndStop('n1');
n2.gotoAndStop('n0');
block._visible = false
} else if (h == 11 || h == 23) {
n1.gotoAndStop('n1');
n2.gotoAndStop('n1');
block._visible = false
}
//for this, create a giant white square to cover the first digit, which represents the tens for the hours, and instance-name it 'block' also, if you haven't figured out by now, you're supposed to name the number movieclips n1-n6 from left to right, and the frames n0-n9
//minutes
//tens
if (m<10) {
n3.gotoAndStop('n0');
} else if (m<20) {
n3.gotoAndStop('n1');
} else if (m<30) {
n3.gotoAndStop('n2');
} else if (m<40) {
n3.gotoAndStop('n3');
} else if (m<50) {
n3.gotoAndStop('n4');
} else {
n3.gotoAndStop('n5');
}
//saves some heart-ache
function mn(t) {
//mn = MiNutes
//t = time
n4.gotoAndStop(t);
}
//ones
if (m == 0 || m == 10 || m == 20 || m == 30 || m == 40 || m == 50) {
mn('n0');
} else if (m == 1 || m == 11 || m == 21 || m == 31 || m == 41 || m == 51) {
mn('n1');
} else if (m == 2 || m == 12 || m == 22 || m == 32 || m == 42 || m == 52) {
mn('n2');
} else if (m == 3 || m == 13 || m == 23 || m == 33 || m == 43 || m == 53) {
mn('n3');
} else if (m == 4 || m == 14 || m == 24 || m == 34 || m == 44 || m == 54) {
mn('n4');
} else if (m == 5 || m == 15 || m == 25 || m == 35 || m == 45 || m == 55) {
mn('n5');
} else if (m == 6 || m == 16 || m == 26 || m == 36 || m == 46 || m == 56) {
mn('n6');
} else if (m == 7 || m == 17 || m == 27 || m == 37 || m == 47 || m == 57) {
mn('n7');
} else if (m == 8 || m == 18 || m == 28 || m == 38 || m == 48 || m == 58) {
mn('n8');
} else if (m == 9 || m == 19 || m == 29 || m == 39 || m == 49 || m == 59) {
mn('n9');
}
//first half of the MOST TEDIOUS PART
//SECONDS
function sn(t) {
//SecoNds(Time)
n6.gotoAndStop(t);
}
//tens
if (s<10) {
n5.gotoAndStop('n0');
} else if (s<20) {
n5.gotoAndStop('n1');
} else if (s<30) {
n5.gotoAndStop('n2');
} else if (s<40) {
n5.gotoAndStop('n3');
} else if (s<50) {
n5.gotoAndStop('n4');
} else {
n5.gotoAndStop('n5');
}
//ones
if (s == 0 || s == 10 || s == 20 || s == 30 || s == 40 || s == 50) {
sn('n0');
} else if (s == 1 || s == 11 || s == 21 || s == 31 || s == 41 || s == 51) {
sn('n1');
} else if (s == 2 || s == 12 || s == 22 || s == 32 || s == 42 || s == 52) {
sn('n2');
} else if (s == 3 || s == 13 || s == 23 || s == 33 || s == 43 || s == 53) {
sn('n3');
} else if (s == 4 || s == 14 || s == 24 || s == 34 || s == 44 || s == 54) {
sn('n4');
} else if (s == 5 || s == 15 || s == 25 || s == 35 || s == 45 || s == 55) {
sn('n5');
} else if (s == 6 || s == 16 || s == 26 || s == 36 || s == 46 || s == 56) {
sn('n6');
} else if (s == 7 || s == 17 || s == 27 || s == 37 || s == 47 || s == 57) {
sn('n7');
} else if (s == 8 || s == 18 || s == 28 || s == 38 || s == 48 || s == 58) {
sn('n8');
} else if (s == 9 || s == 19 || s == 29 || s == 39 || s == 49 || s == 59) {
sn('n9');
}
//part two of the most tedious part
};

This took a solid 8 hours (work-time only, the time over all was about 3 days) to do, mainly drawing and naming shit. The rest, which probably took about 1 hour out of the total 8, was coding (the code goes into one single frame, by the way)

The finished product

Other versions:

First Version

Color Version (use C to activate color change, and 0-9 to change color)

First 3D version

Below is a picture of the .Fla

Yeh, it's AS2, don't hate.

Organization of fucking EVERYTHING really saved my ass on this; I used a grid to EXACT the location of everything you see, I used exact lines and exact names for everything, I organized even the coding with Documentation.

Lol, do you think I should post this to the portal? I don't really know if it's PORTAL material but it is in fact a gadget, a gadget that tells you the time :D

Advanced 3D Digital Clock!


Comments

Comments ain't a thing here.