Jump to content
  • Advertisement
Sign in to follow this  
  • entries
  • comments
  • views

Three, two, one, you're out! Adding the countdown timer, and other bits

Sign in to follow this  


Over the past month I have busied myself adding lots of tiny bits to the game, some of which are obvious to players and others not.

I have added a new menu design, with sound effects and animations;


I have also added a new logo for the game on the menu screen.


I have also sped up and increased the pitch of the boss's speech so now he sounds more like an unintelligable voice on the other end of a cartoon telephone conversation - i think this sounds much nicer, and i have made the text in the speech bubble incrementally appear as the boss speaks. Every syllable of gibberish causes appearance of one new word until all are displayed, or the mouse is clicked to cancel it.

More importantly, I have also added a clock to the game. The original 2D version had this clock, but it never was finished, when it reached zero, it would do nothing.

As you can see the clock starts with its 'minute' hand at the 3PM position, and the 'second' hand makes one complete revolution per real-time second. Each revolution of the second hand advances the 'minute' hand to the position of "360 / time limit * elapsed seconds" degrees around the clock face. The clock face is drawn rather simply: clocksprite->Draw(position); float radians = minuteshand * (M_PI / 180.0f); rt->DrawLine(centre, D2D1::Point2F(centre.x + (cos(radians) * handlength), centre.y + (sin(radians) * handlength)), minutes_brush, 8.0f * scale.x); if (running) { radians = (secondshand - 90.0f) * (M_PI / 180.0f); rt->DrawLine(centre, D2D1::Point2F(centre.x + (cos(radians) * handlength), centre.y + (sin(radians) * handlength)), seconds_brush, 3.0f * scale.x); } clockglass->Draw(position); if (HurryUp && running && !creator->IsPaused()) title->Draw("HURRY UP!", titlepos, messageopacity);
When writing this code i did consider using matricies to translate the positions of the lines used for the hands, but i decided that in this case, good old-school sine and cosine seemed more readable to me, and they work well.

When at least 70% of the time allowed for the level is taken up, the clock starts to shake (as if under pressure) and a message appears on the screen stating to 'HURRY UP!'. If the player still hasn't finished the level when over 90% of the time is taken up, the clock shakes more violently still, and once all time is taken up, all crates active in the level explode, which can and usually leads to level failure. Level* lev = creator->GetLevel(); D2D1_RECT_F rumble = position; float used = Ticks / lev->TimeLimitSeconds; if (running && !creator->IsPaused() && lev && used > 0.7f) { float offset_x, offset_y; if (used > 0.9f) { offset_x = Util::Rand(-4.99f, 4.99f) * scale.x; offset_y = Util::Rand(-4.99f, 4.99f) * scale.y; } else { offset_x = Util::Rand(-2.99f, 2.99f) * scale.x; offset_y = Util::Rand(-2.99f, 2.99f) * scale.y; } rumble.top += offset_y; rumble.bottom += offset_y; rumble.left += offset_x; rumble.right += offset_x; clocksprite->Draw(rumble); } else clocksprite->Draw(position);
At each of the incremental changes at 70% of the allowed time limit and 90% of the allowed time limit, the pitch and speed of the game music increases, in a rather comical way. I got the inspiration from this from sonic the hedgehog, on the underwater levels when running out of oxygen. No matter how much i try, i will never forget the frustration of those levels and that tune always sticks in my head. float used = Ticks / lev->TimeLimitSeconds; if (used > 0.9f) { creator->GetSFX()->SetMusicPitch(1.8f); } else if (used > 0.7f) { creator->GetSFX()->SetMusicPitch(1.5f); HurryUp = true; }
In many levels the addition of this clock will add extra challenge to the game, and was a missing game mechanic i have been waiting until now to implement.

Next on my to-do list is power ups. I have several of these in mind each of which can be purchased with points acrued from successfully completing levels:

  • A glue gun, which makes a piece of conveyor sticky, pasting a box to it which won't move for a while
  • A grease gun, which has the opposite effect, accellerating any box to pass over it
  • A grab claw, like those seen in amusement arcades, which takes any selected box and deposits it somewhere else of your choosing
  • A spanner, which when thrown at a machine disables it for a while and stops it producing crates, changing the order of production

    There is room for more (and i'm open to suggestions in the comments!) but these were the four that i planned to have level designs to exploit.

    Comments as always are welcome! smile.png

Sign in to follow this  


Recommended Comments

Good work, I like the handpainted art.



Comments as always are welcome! smile.png

I don't know if you have this already on your todo list, but the most outstanding thing is the absence of shadows. I think that shadows will improve the visual quality a lot, even fake shadows will add a nice touch to it. Something you should add to your todo list ;)

Share this comment

Link to comment
Yeah I was thinking shadow mapping would be quite easy using a stencil buffer. I've been reading up on it but it's kind of on the back burner till all the gameplay mechanics are in and done...

Share this comment

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!