Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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.

share|improve this question
1  
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. –  Roy T. Mar 27 '12 at 18:23
    
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 –  Anearion Mar 27 '12 at 18:49
add comment

1 Answer

up vote 2 down vote accepted

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

share|improve this answer
    
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 ? –  Anearion Mar 27 '12 at 18:09
    
@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 :) –  James Mar 27 '12 at 18:10
    
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! –  Anearion Mar 27 '12 at 18:13
    
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. –  James Mar 27 '12 at 20:22
    
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. –  Nate Mar 27 '12 at 20:38
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.