kbran420 / beginning-android-games

Automatically exported from code.google.com/p/beginning-android-games
0 stars 0 forks source link

Droid Invaders: Bad bounds of back button in SettingScreen #30

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
[ Bug ]
Back button on settings screen in Droid Invaders isn't working properly. Its 
bounds are set at right-top from the proper place (you have to touch somewhere 
between arrow and image of hand).

[ What is wrong ]
I found these lines in ch12-droidinvaders/(...)/SettingsScreen.java (revision 
26):
    33:  soundBounds = new Rectangle(360 - 32, 160 - 32, 64, 64);
    34:  backBounds = new Rectangle(32, 32, 64, 64);
and these
    97:  batcher.drawSprite(360, 160, 64, 64, (...)
    100: batcher.drawSprite(32, 32, 64, 64, Assets.leftRegion);
So there is no substraction of 32 in backBounds' x and y.

[ Solution ]
It should be:
    34:  backBounds = new Rectangle(32 - 32, 32 - 32, 64, 64);
Now I can touch the arrow to get back to main menu.

[ Additional info ]
Device: Samsung Nexus S
OS: Android 2.3.4

Original issue reported on code.google.com by pawelbar...@gmail.com on 7 Sep 2011 at 12:22