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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T00:10:20+00:00 2026-06-04T00:10:20+00:00

Okay I have a game I’m working on that sets a 12×16 grid on

  • 0

Okay I have a game I’m working on that sets a 12×16 grid on the screen and then draws a pattern on the screen like so http://oi49.tinypic.com/53odih.jpg

I’m just wondering if there is a way using code to see if the box exists inside of the pattern or not?

This is how I’m looping though my grid boxes

    //Set all blocks to default
    for(int i=0;i<tilesX;i++){
        for(int j=0;j<tilesY;j++){
            blocks[i][j] = 0;
        }
    }

If a block is part of a pattern I set the block to 1. I want the blocks inside the pattern set to 2, but I can’t think of a way to do this programmatically. The pattern will always be a complete shape and will always connect back to the starting point.

I hope that’s not too confusing and I’m willing to provide you with what ever you need but I’m just lost on how to do it. Thanks

  • 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-04T00:10:21+00:00Added an answer on June 4, 2026 at 12:10 am

    You need to implement the flood fill algorithm. Depending on how you draw the state of 2, you can flood fill the area starting at a known point inside the shape. Then check to see if its 0 (outside), 1 (border), or 2 (inside).

    I think I’m grasping what you want here, but let me know if I’m off base.

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

Sidebar

Related Questions

Okay, so I have this partially working game, I know the solutions should be
Okay I have something that looks like this: Company Name-1234 I only want the
Okay I have a large CRUD app that uses tabs with Forms embedded in
Okay so I have a web view that holds the chat bar div from
Okay, I'm writing a game that has a vector of a pairent class (enemy)
I have 5 game sections that will use the same template sheet, but they
Okay I have a project in CMake structured like this: CMakeLists.txt /libfoo/CMakeLists.txt /frontend/qt/CMakeLists.txt libfoo
Okay I have three tables that all communicate with each other. ForumTopic t ForumMessage
Okay, so I have an AJAX function that gets a JSON encoded string from
Greetings stackoverflow community! I am working on an Android game that uses Box2D for

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.