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 8313477
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T20:30:03+00:00 2026-06-08T20:30:03+00:00

Good morning. I’m on linux, using cocos2d-x for Android . I have created a

  • 0

Good morning.

I’m on linux, using cocos2d-x for Android.

I have created a function that calculate circle values.

        // Circle point updateCircle()
    // x = number of iteration · SamplingPeriod   |-|-|-|
    // y = A · sine ( 2 · PI · number of iteration · SamplingPeriod / Period )
    int iterations = this->getNumberOfIterations();
    CCPoint centerPoint = this->getCenter();
    float x = centerPoint.x + this->getAmplitude() * cos( 2 * M_PI * iterations * this->getSamplingPeriod() * this->getFrequency() );
    float y = centerPoint.y + this->getAmplitude() * sin( 2 * M_PI * iterations * this->getSamplingPeriod() * this->getFrequency() );

    _newPoint = ccp( x, y );

        // Create Array Actions
    CCArray *myActionsArray = new CCArray(3);

    // Set action move
    CCAction *actionMove1 = CCMoveTo::create(this->getSamplingPeriod(), newPoint);                         // Move to next point
        CCAction *actionMove2 = CCCallFuncN::create(this, callfuncN_selector(GameObject::updateCircle));       // call again this function

        // Insert Objects
    myActionsArray->insertObject(actionMove1, 0);
    myActionsArray->insertObject(actionMove2, 1);

    // Create Sequence
    CCAction *action = CCSequence::create(myActionsArray);

        // Set Tags
    action->setTag(kActionMove);

    // Run
    this->runAction(action);

    // Set new call to put new point in SamplingFrequency ms
    iterations += 1;
    static const int maxIterationCycle = 1 / (this->getSamplingPeriod() * this->getFrequency());
    if (iterations >= maxIterationCycle)
    {
        iterations = 1;
    }

    this->setNumberOfIterations(iterations);
    CCLog("texttx Iterations %d/%d", iterations, maxIterationCycle);

Alternativally, i have tried:

   
    // Set action move 
    CCAction *actionMove1 = CCCallFuncN::create(this, callfuncN_selector(GameObject::macroSetNewPoint));
    CCAction *actionMove2 = CCDelayTime::create(this->getSamplingPeriod());
    CCAction *actionMove3 = CCCallFuncN::create(this, callfuncN_selector(GameObject::updateCircle));

And

        // Set action move
    CCAction *actionMove1 = CCMoveTo::create(this->getSamplingPeriod(), _newPoint);
    CCAction *actionMove2 = CCDelayTime::create(this->getSamplingPeriod());
    CCAction *actionMove3 = CCCallFuncN::create(this, callfuncN_selector(GameObject::updateCircle));

The problem is that my game object moves in circles, but after 1000 iterations approx, it dissapears, and appears again in a few seconds.
I don’t know what is going on
– The points are correctly calculated (i think)

Maybe moveto needs more time to execute?
How could I calculate a math patron to move my sprites following it?

  • 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-08T20:30:04+00:00Added an answer on June 8, 2026 at 8:30 pm

    I have tested your code and work ok. Please, check if you are updating a point from another callback or something. If data is public, it could be been updated by another part of the code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Good morning gang. I have a jQuery Datepicker object that is prepoulated using a
Good morning, I have mysql queries where I would like to calculate percentage of
Good Morning, Say I have an insert statement: Insert INTO tblTest (fieldOne,FieldTwo,fieldThree) VALUES ('valueOne','valueTwo','null')
Good morning! I'm programming a managment aplication that shows a task list using WPF
Good Morning, I have copied this code from somewere <script type=text/javascript> $(function() { setInterval(rotateImages(),
Good morning. I have a modal JQuery dialog that on Open calls and loads
Good Morning, I have a SharePoint site that I've been trying to fix up
good morning, I was trying the SharedPreferences Class and I have created two classes,
Good morning folks, I'm just that beginner in json, I have a formated data
Good morning, I have problem with using MasterPage and jQuery. I using jQuery UI

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.