I'm a java/android programmer, but I don't have any experience in game programming, I'm already reading proper books, like "Pro Android Games", but my concerns are more about the ideas behind game programming than the techniques themselves.

I'm working on a 2D game, something like Cluedo to let you understand the genre. I would like to know how should I act with the "scenes", for example, a room with a desk, TV, windows and a lamp. I need to make some items tappable and others not. Is it common to use one image (invisible to the user) with every different item a different color, then call the getColor() method on the image? Or use one image as background, and separate images for all the items? If the latter, how can I set the positioning? and should I use imageView or imageButton?

I'm sorry if those are really low quality questions, but as "outsider" ( I'm 23 and still finishing my university ) it's pretty hard learn alone.

  • 1
    \$\begingroup\$ Is this a Scene-Management question? Like having transitions between different rooms, menu's, etc.. and managing their update loops? Or are you just interested in collision detection between your mouse and the current object? For the last there are numerous approach, bounding boxes, bounding polygons, the color trick you mentioned, It's all fairly easy in static 2D scenes. \$\endgroup\$
    – Roy T.
    Mar 27, 2012 at 18:23
  • \$\begingroup\$ nope this isn't about transitions, I'm interested in collision detection and in how to create the scene, fixed-positioning more than relative and basic arguments like that. I'm not new about GUI, but I'm not sure is the same \$\endgroup\$
    – Anearion
    Mar 27, 2012 at 18:49

1 Answer 1


I think you will find positioning the easier way to go. One background image then the item images on top of it. You can see where a user clicked and then test the item image dimensions to see if they clicked inside one of them and which one of them.

Hope this helps

  • \$\begingroup\$ thanks for the answer! This way is similar to the color one, but if i use a different image, and so a different object in my code, why should I check the item dimension to understand with one is clicked ? \$\endgroup\$
    – Anearion
    Mar 27, 2012 at 18:09
  • \$\begingroup\$ @Anearion No worries, that is why we are here. If it helps Id appreciate an up-vote, if its the answer you were looking for Id appreciate it being marked as such as well :) \$\endgroup\$
    – James
    Mar 27, 2012 at 18:10
  • \$\begingroup\$ bump, just to let you know, i edited after you answered me :D, and sorry but i cant vote up yet ( new account on this stack-section ), but i will for sure as soon as i can! \$\endgroup\$
    – Anearion
    Mar 27, 2012 at 18:13
  • \$\begingroup\$ Ah, sorry I can not help with the specifics as I have not made an android app before so I am unsure of the component's members/methods and such. \$\endgroup\$
    – James
    Mar 27, 2012 at 20:22
  • \$\begingroup\$ What @James is talking about, is rendering multiple images to your screen. The idea here is that you then must know the screen position of each image, to check for a collision when the user taps the screen. Possibly the built-in image controls already provide similar functionality; however, I suspect you will run into performance limitations using them and need to switch to a more standard renderer. \$\endgroup\$
    – Nate
    Mar 27, 2012 at 20:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .