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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T14:10:11+00:00 2026-06-06T14:10:11+00:00

Working on game where plates will be falling from top to bottom. Some plates

  • 0

Working on game where plates will be falling from top to bottom. Some plates will also “bounce” on the ground and then start moving upwards again. This leads situations where a falling plate collides with a “rising plate”.

My problem? I don´t know how to detect this collision.

Since all the plates comes from the same class I can´t write
if(CGRectIntersectsRect([self boundingBox], [self boudingBox]))
since this statement will always be true.

I create the plates with a for-loop:

for(i=0; i<9; i++){

 Plate *plate = [Plate initPlate];

}

and then just reuse these plates throughout the game.

Any ideas or work arounds on how I detect a collision between two plates? Any advice would be greatly appreciated.

Regards.

  • 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-06T14:10:13+00:00Added an answer on June 6, 2026 at 2:10 pm

    You need to have a class that manages (for example using a NSMutableArray) the set of plates, and instead of checking for collisions on the Plate class you do it on this new class.

    Assuming your array is:

    NSMuttableArray *plateSet
    

    You can do this:

    for (Plate *bouncingPlate in plateSet)
    {
        if ([bouncingPlate bouncing])
        {
            for (Plate *fallingPlate in plateSet)
            {
                if (![fallingPlate bouncing])
                {
                    /* Check for collision here between fallingPlate and bouncingPlate */
                }
            }
        }
    }
    

    Or, more elegantly:

    for (Plate *bouncingPlate in plateSet)
    {
        if (![bouncingPlate bouncing])
        {
            continue;
        }
    
        for (Plate *fallingPlate in plateSet)
        {
            if ([fallingPlate bouncing])
            {
                continue;
            }
            /* Check for collision here between fallingPlate and bouncingPlate */
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I had my game working and then decided to try and implement a menu
I'm working on a game project and I've written some basic code that allows
I'm working on 2d game dev project. It's some kind of board game. As
Alright so here is my issue. I'm working a game engine that will eventually
I'm working on a game which will use projectiles. So I've made a Projectile
currently i am working in game application, Already i have one viewcontroller (and make
I've been trying to get this Sudoku game working, and I am still failing
Iam working on a game in which I have created a horizontal scrolling menu
I am working on a game, in which i am trying to fire two
I'm working on a game made in XNA,C# and I want to enable xml

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.