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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T15:28:41+00:00 2026-06-11T15:28:41+00:00

So Im using a simple if statement to increase an object’s speed when an

  • 0

So Im using a simple if statement to increase an object’s speed when an score is reached. Im using a very simple if statement that doesnt work. In this context, “pigSpeed” controls the velocity of the object.

    float difference = (self.view.bounds.size.height/4) - flyingPig.center.x; 

    score += -(int)difference;

    if (score % 1000 == 0 & score > 0)
    {
        pigSpeed++;
        NSLog(@"pigfaster");
    }

I know the score works properly, as it is displayed, as it appears, but the if statement just wont work and nothing happens. What am I doing wrong. I can add more code if needed.

  • 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-11T15:28:42+00:00Added an answer on June 11, 2026 at 3:28 pm

    & is the bitwise and operator; && is the logical and that you mean to use here. Your if statement should actually read:

    if (score % 1000 == 0 && score > 0)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

im using simple vector push_back to object of Type A and getting this error
I'm using simple close browser javascript statement window.close(); but it doesn't work with any
I am using simple insert statement to insert value to CLOB varaible, anyway i
I am using a simple try-with-resources statement like the following: try (final CSVWriter w
I'm programming a simple text-based RPG using a switch statement for a game loop.
I am using PHP's date function. The statement is as simple as $t= 1339455660;
Using simple type like class A { public int X, Y; } with object
I have a sql statement I am using a simple sort such as the
I'm having trouble finding a simple statement to skip the duplicates for this recursive
I'm using a simple MySQL statement to query my DB for product suggestions sorted

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.