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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T10:45:39+00:00 2026-05-24T10:45:39+00:00

I finished my game (cocos2d) but when I make an archive (from xcode product->Archive)

  • 0

I finished my game (cocos2d) but when I make an archive (from xcode product->Archive) then click on share (to get game.api) then put it in the itunes and sync to my iphone the accelerometer it seem that it didn’t work I tested the game in 5 devices and it didn’t work, the ship always in fix place and it didn’t move, But if I click build and go from the xcode it work properly on all the developer devices I use the code below :

inside the init

- (id)init
{
    if ((self = [super init]))
    {
    self.isAccelerometerEnabled = YES;
    [self scheduleUpdate];
}

accelerometer handeler:

- (void)accelerometer:(UIAccelerometer *)accelerometer 
    didAccelerate:(UIAcceleration *)acceleration {

#define kFilteringFactor 0.1
UIAccelerationValue rollingX, rollingY, rollingZ;

rollingX = (acceleration.x * kFilteringFactor) + 
    (rollingX * (1.0 - kFilteringFactor));    
rollingY = (acceleration.y * kFilteringFactor) + 
    (rollingY * (1.0 - kFilteringFactor));    
rollingZ = (acceleration.z * kFilteringFactor) + 
    (rollingZ * (1.0 - kFilteringFactor));

float accelX = acceleration.x - rollingX;

CGSize winSize = [CCDirector sharedDirector].winSize;

#define kRestAccelX 0.6
#define kShipMaxPointsPerSec (winSize.height*0.5)
#define kMaxDiffX 0.2

float accelDiffX = kRestAccelX - ABS(accelX);
float accelFractionX = accelDiffX / kMaxDiffX;
float pointsPerSecX = kShipMaxPointsPerSec * accelFractionX;

_shipPointsPerSecY = pointsPerSecX;

}

ship position:

- (void)updateShipPos:(ccTime)dt {

    CGSize winSize = [CCDirector sharedDirector].winSize;

    float maxY = winSize.height - _ship.contentSize.height/2;
    float minY = _ship.contentSize.height/2;
    float newY ;
    (isYAxisInverted) ? newY = _ship.position.y + (-_shipPointsPerSecY * dt) : newY = _ship.position.y + (_shipPointsPerSecY * dt);
    newY = MIN(MAX(newY, minY), maxY);
    _ship.position = ccp(_ship.position.x, newY);

}

and in the update :

- (void)update:(ccTime)dt {
...
    [self updateShipPos:dt];
...}
  • 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-05-24T10:45:40+00:00Added an answer on May 24, 2026 at 10:45 am

    the solution is to replace:

    UIAccelerationValue rollingX;

    by

    UIAccelerationValue rollingX = 0, rollingY = 0, rollingZ = 0;

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

Sidebar

Related Questions

I've finished my poker game but now I want to make it look a
I finished my website and uploaded it to my webhost, but i get this
I just finished my new game using Cocos2d (v 0.99.1) for iPhone. Before releasing
I am almost finished with my game now, but today I encountered a real
I am almost finished with this flash game, but when I test it the
I am trying to make a Texas Holdem LAN game. Game flow is finished
I just finished installing Panda3d on my Mac, a 3d Python game engine, but
After I finished coding the difficult parts of my game, I found some memory
I have recently finished phase 1 of my Facebook game: Rails Across Europe It
Already finished implementing the player. I want to implement the progress bar. But I

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.