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

  • Home
  • SEARCH
  • 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 7042687
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:11:55+00:00 2026-05-28T02:11:55+00:00

i am making a game using andengine in android, in this game various sprites(eggs)

  • 0

i am making a game using andengine in android, in this game various sprites(eggs) are moving here and there on screen.i want to get touch event of each sprite independently, sometimes when one sprite is over another then onAreaTouched() give touch event of both sprites,in case when i return here false or super.onAreaTouched(),if i return here true then a sprite moving over the area which is registered for another sprite could not give the touch event

So what is appropriate way to get touch event of only upper shown sprite.

  • 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-28T02:11:56+00:00Added an answer on May 28, 2026 at 2:11 am

    The other approach you could use is an IOnSceneTouchListener, with the onSceneTouchEvent method. You can get the X & Y from the pTouchEvent parameter, and check whether any sprite contains it.

    Now, in case you didn’t know, each entity has a list of children (And your scene is an entity).
    When an entity draws itself, it also calls the draw methods of the children. The childrens’ draw methods are called from the first child method to the last (As their order in the list); Therefore, the first child on the list is drawn first. The last one is drawn last. So the last one will always override any other entities it is drawn over.

    So, iterate over the scene children list from the last children to the first. If any sprite contains the point of touch, let it handle the event and return true to say that you consumed the event.

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

Sidebar

Related Questions

So in an android game (using andEngine) I'm making, I'm trying to save a
I'm making a javascript game without using canvas, and I want the screen to
I am making a game for Android and using Rails for server coding, and
So here is what I am trying to do.I am making a game using
I am making a game using html canvas. Here is my progress: http://db.tt/ei3LlR (use
I'm making a game using cocos2d-iphone, I want's to rotate a Texture2D of maybe
I've been making a game using the rokonandroid game engine, but I randomly get
I'm making an iPhone game and using UIView objects to draw sprites. Most of
I'm making my first game using Java on Android. I need to draw a
I am making a top-down platformer game using sprites. I would like to add

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.