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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T06:15:42+00:00 2026-05-29T06:15:42+00:00

I am wondering if there is any simple tool within Cocos for automatically determining

  • 0

I am wondering if there is any simple tool within Cocos for automatically determining if a sprite is visible. I could code up a bunch of logic on my own, but it would be nice if Cocos already has a simple test built-in to see whether a sprite is visible or otherwise hidden behind another sprite. Since Cocos has many other tools that obviate the need for custom logic in many places, this would seem like a likely part of that toolset, but I cannot find anything so far in my searching.

It would be a simple case of having it test if the bounding box for all sprites with a higher z setting are covering or hiding the bounding box of the sprite in question.

  • 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-29T06:15:43+00:00Added an answer on May 29, 2026 at 6:15 am

    You can use this function to determine if two rects (the bounding boxes of the sprites) intersects:

    CGRectIntersectsRect(rect1, rect2);
    

    and then calculate the z-order.
    If you want to be more precise you can calculate an index to know how much the first sprite cover the second:

    Index = (2 * Area (CGRectIntersection(rect 1, rect2)))/(Area(rect1) + Area(rect2));
    

    CGRectIntersection calculate the rectangle generated by the intersection of the other two.
    If Index is 1 the two rectangles are precisely one above the other.

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

Sidebar

Related Questions

I'm wondering if there are any simple ways to get a list of all
I was wondering if there are any performance differences when using simple queries as:
I am wondering if there is a simple snippet which converts links of any
i'm wondering if there is any nice and neat tool to replace the GNU
I was wondering if there were any simple examples that did the following *
i was wondering if there was any simple way around sorting tuples in lists
Hi I was wondering is there any simple example of implementing a high score
I was wondering if there was any simple way to authenticate Openfire users against
I was wondering - are there any known techniques to control access to a
I am wondering is there any way we can test the font size/color of

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.