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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:39:50+00:00 2026-05-26T19:39:50+00:00

Currently, I’m building a game with pure UIKit. It’s a game where some character

  • 0

Currently, I’m building a game with pure UIKit. It’s a game where some character is catching falling items. All the objects are moving along the three points trajectory: each object appear at point A, then move to point B and then fall to point C. For me, it is important only one moment – item in point B. I need to check, does the character is catching the item in point B. Currently, I have a timer in the main game controller that is constantly posting notifications. Game items are observers, they listen to that notification and reposition themselves (they move themselves). Now, with that timer, each item is moving by the small steps from point A to point B. When it is at point B, an item method checks, does the character is catching him. If no then I’m performing UIView animation with duration from point B to point C.

I’m thinking that the whole movement could be animated, maybe with Core Animation CAKeyframeAnimation class or smth. The only problem is, I’m not sure about how to fire a callback for checking the catch in the middle of animation – in the point B. Some say that it is impossible here and if I have the whole animation and I need to get current item position then I need to have a timer that is regularly pulling/reading the model data from presentationLayer. But I’m not sure about this approach because, now, I do not store a pointer to screen items from my main game controller – the game controller only creates an item and game timer posts notifications to those objects. But I would need to have such one in order to implement proposed solution. Also, I should read the presentationLayer from the whole bunch of screen items.

The another alternative would be to split one animation into two animations: first, animate from A to B and then to fire a completion callback for checking a catch. Then, perform another animation from B to C.

Guys, what are your opinions on that, maybe you have another proposals?

  • 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-26T19:39:50+00:00Added an answer on May 26, 2026 at 7:39 pm

    I think you need to split it into two animations. It’s correct that you only haveanimationDidStartandanimationDidStopdelegate methods withCAAnimation.
    The approach to use anNSTimercould be problematic. presentationLayer values will be updated on the main thread. My guess would be that checking thepresentationLayervalues on a different thread where the timer is running could give incorrect values.

    You could get around that by usingperformSelectorOnMainThread. Then, the issue would be reliable scheduling of that method invocation. I.e., when you invoke performSelectorOnMainThread, it is up to the runtime to execute that at it’s convenience.

    For the record, I’m also writing a game in pure UIKit. The biggest headache hasn’t been the animations during normal play. Instead, it’s stopping and resuming them during interruptions such as pausing the game, accepting calls, moving to background, etc. Especially a purge from memory while the game is in background.

    I’ve written a bit about this in the answer to this question:

    Restoring animation where it left off when app resumes from background

    Consequently, for the next game I’m going to have a close look at cocos2d to see what it offers in this regard.

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

Sidebar

Related Questions

Currently I am using Amazon Cloudfront to service static objects on my ASP.Net MVC3
currently we have quite a chunky auditing system for objects within our application, the
Currently, working with RC0 Denali, having some issues I am attempting to review data
Currently I'm doing some unit tests which are executed from bash. Unit tests are
Currently I'm storing configuration as default values in respective objects. But this is very
Currently, I'm storing MySQL query results in an array of objects, where each object
Currently, I am writing a MiddleWare application that synchronizes information between and accounting application
Currently I am using HTML files for parts of my user interface. I display
currently, I`m implementing a map App with Mono4Droid and there I`m using a WebView
Currently I'm starting a new Activity and calling finish on a current one. Is

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.