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

  • Home
  • SEARCH
  • 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 6237667
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T11:04:19+00:00 2026-05-24T11:04:19+00:00

When the user touches the screen, it looks at the boolean with an if

  • 0

When the user touches the screen, it looks at the boolean with an if and triggers a timer when value is NO. It sets it to YES so the user can’t trigger it again when it’s going. When the timer finishes what it’s doing, it sets it back to NO. The value is initialized in the viewDidLoad method. It works once, but will not work again. From the way things look, it SHOULD work. Can anyone see what’s wrong with this:

 - (void) fireLoop {

    fireImage.hidden = 0;
    fireImage.center = CGPointMake(fireImage.center.x, fireImage.center.y - 20);
    if (fireImage.center.y == -5) {
        [fireTimer invalidate];
        fireImage.hidden = 1;
        firedOn = NO;
    }
}

- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {

if (firedOn == NO) {
    firedOn = YES;
     //set fire image position to player position
    fireImage.center = CGPointMake(playerImage.center.x, playerImage.center.y);
    fireTimer = [NSTimer scheduledTimerWithTimeInterval:1.0/30 target:self selector:@selector(fireLoop) userInfo:nil repeats:YES];
}  
}
  • 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-24T11:04:20+00:00Added an answer on May 24, 2026 at 11:04 am

    You reset firedOn variable only if fireImage.center.y is exactly -5 – check if that it is really so. If not – you probably need to tweak that condition (check if y is less then -5 for example or if it lies in some interval instead of 1 exact value)

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

Sidebar

Related Questions

i am trying to do this: 1) user long touches the screen, 2) a
wat i am trying to is, each time user touches screen, i am adding
I need to apply a function when the user touches the screen with two
In my application when the user touches the screen, I put an UIImageView on
Just curious. When the user touches the screen in an iPhone app, how does
I have a Live Wallpaper that uses various screen touches to trigger certain events.
How to fire an event when user touches to screen an another(this is the
I can make a gesture which detects a movement when the user touches the
I would like to detect when user touches screen constantly for 5 seconds. No
i am trying to put a new marker everytime the user touches the screen.

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.