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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:46:27+00:00 2026-06-15T12:46:27+00:00

So i have sprites that are should be un-walkable for my character. The problem

  • 0

So i have sprites that are should be un-walkable for my character.

The problem is im not sure how to do this.

Here is what i am trying. I am having the sprites added to a Linked List when they are loaded from the level.

Then i iterate through the list to detect if the character is colliding with any of the unwalkable sprites/tiles.

I do this on the engines update thread which runs about every second.

Here is how i am doing this:

mScene.registerUpdateHandler(new IUpdateHandler(){

        @Override
        public void onUpdate(float pSecondsElapsed) {


            Iterator<Sprite> wall_collision = unwalkable_Sprites.iterator();

            while(wall_collision.hasNext()){
                Sprite sprite = wall_collision.next();

                if(character_sprite.collidesWith(sprite)){


                }
            }

        }

        @Override
        public void reset() {
            // TODO Auto-generated method stub

        }

    });

So the question is how do i position the character when it collides with the unwalkable tile so the character doesnt even cross over into the tile..To the user it should seem like a boundary.

Does anyone have any suggestions or know how i can do this?

  • 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-15T12:46:28+00:00Added an answer on June 15, 2026 at 12:46 pm

    Look into this example

    use the same code for you un-walkable tiles as “ground” in example. You should use static bodies:

    this.mPhysicsWorld = new PhysicsWorld(new Vector2(0, SensorManager.GRAVITY_EARTH), false);
    final FixtureDef wallFixtureDef = PhysicsFactory.createFixtureDef(0, 0.5f, 0.5f);
    

    Here you can use Shape as in example or for example Sprite

    //final Shape yourTile = new Rectangle(0, CAMERA_HEIGHT - 2, CAMERA_WIDTH, 2);
    Sprite yourTile = new Sprite(...);
    PhysicsFactory.createBoxBody(this.mPhysicsWorld, yourTile, BodyType.StaticBody, wallFixtureDef);

    Here you can find box2dExtension for AndEngine (it need for using Bodies)

    Sorry for my English 🙂 Hope this will help you.

    P.S. and you don’t need to check collisions for this issue anymore.

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

Sidebar

Related Questions

I have an image file that has all the character sprites that I will
I have an orthographic projection, and I am drawing sprites. The problem is that
I have a few buttons on my page that are styles using sprites, in
I have two sprites in my app. Both should have touches enabled and both
I have 2d character art that will be mapped to a Box2d skeleton. The
This is quite hard to explain. I have a class which should support the
I'm not too quite sure about what i should do about a grouped set
I'm trying to have no size difference from sprites, if you increase the z
I have a navigation that I made using CSS Sprites. The thing is I
I have sprites(which have bodies) that can fall down into a box, in a

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.