Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9323179
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T04:16:50+00:00 2026-06-19T04:16:50+00:00

My countdown gets updated every second using my InGameTime value that is updated every

  • 0

My countdown gets updated every second using my InGameTime value that is updated every frame.

This works great visually because I can just round the game time to the nearest int.

…But how do I get my app to play a beep after each second?

Below is my code:

-(void) setTimer:(ccTime) delta{

    int timeInSeconds = (int)appDelegate.InGameTime;//Game time E.G: 8.2332432
    /*

            Stuff is here to display the tempTime

    */


    //The below effect plays the sound every frame, 
    //is there an equation that I can apply to appDelegate.InGameTime 
    //that will play it once a second?

    [[SimpleAudioEngine sharedEngine] playEffect:@"tick.mp3"];

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-19T04:16:51+00:00Added an answer on June 19, 2026 at 4:16 am
    -(void) setTimer:(ccTime) delta{
    
        static float timeSinceLastTick = 0.f;
    
        int timeInSeconds = (int)appDelegate.InGameTime;//Game time E.G: 8.2332432
        /*
    
            Stuff is here to display the tempTime
    
        */
    
        // if your delta is small and relatively constant, this 
        // should be real close to what you want.
        // other ways exist
    
        timeSinceLastTick += delta;
        if (timeSinceLastTick > 1.0f) {
           timeSinceLastTick=0.f;
           [[SimpleAudioEngine sharedEngine] playEffect:@"tick.mp3"];
        }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using this plugin for a countdown clock Its great, but I need
I have a simple countdown timer that updates a label every second. How do
I am creating Christmas countdown and I need to count down every second and
I've created a countdown timer and it works great.. but when it reaches zero
I have a javascript countdown timer that works by taking a specified date and
I am trying to use a time that updates a label every second (so
I am using a countdown timer class and in the onfinish() state of that
I'm using jquery_countdown (http://keith-wood.name/countdown.html) to set a 60-minute timer. I know that I can
I have a simple countdown that is activated by a button. Using onclick i
I am using Countdown Plugin . I am trying to set a countdown say

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.