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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:25:27+00:00 2026-05-26T16:25:27+00:00

[layer tileGIDAt:position] If I give it a position outside the map, I get an

  • 0
[layer tileGIDAt:position]

If I give it a position outside the map, I get an Assertion Failure, which is just normal.

I need a way to know when a tile exists. Before running the above code so I don’t get a an Assertion Failure and also to do other things in case the tile does not exist. But how can I? Is there not a method in the CCTMXLayer class to check that?

  • 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-26T16:25:28+00:00Added an answer on May 26, 2026 at 4:25 pm

    To test if a tile exists, test if the tile GID is 0. Before that you can test if the position is on the tilemap as such:

    if (position.x < layer.size.width && 
        position.y < layer.size.height &&
        position.x >= 0 && position.y >= 0)
    {
        // position is within tilemap layer …
    
        if ([layer tileGIDAt:position] != 0)
        {
            // tile at position exists …
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a data layer which is returning lists of classes containing data. I
I have a data layer project which receives a byte array that needs to
Layer 3 - Interface Layer 2 - Business logic (get input from user, check
I've got a 'layer' that I want to give an onclick. The trick is
Which layer is the best layer to make linq-sql calls as SubmitChanges(), InsertOnSubmit() etc.
In my business layer, I need many, many methods that follow the pattern: public
Was wondering in which layer project i should put the DbContext implementation if i
hi made an object layer on my tile map with tile map editor like
I need to layer 3 div inside a container div and have them all
Which layer should the repository classes go in? Domain or Infrastructure?

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.