Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat
Why does game chaeck all buttons when last button is clicked? - Gideros Forum

Why does game chaeck all buttons when last button is clicked?

I am basically following ar2rsawseen's book, "Gideros Mobile Game Development".

I have attached two screenshots with the code I'm having a problem with. The first is the file for my button class. The seconde is a part of the code from my "play" scene. This screenshot shows the code for 2 "choice" buttons, buttons the player clicks on for what he thinks is the correct answer. There are actually 4 buttons, but I could onlt fit 2 in the screeshot. The other two are identical except for the numbers in the names.

A note: In this iteration, I just have the function called by each button change the scene of the game to a different secene. Each button goes to a different scene. I'm only doing this to test the buttons and the functionality will eventually be quite different.

At first glance, it seems to work fine. Each time I run it, when I click one of the buttons, the game changes to the correct new scene.

If I didn't have the print statment in line 13 of the button class file, I wouldn't know there's a problem. In the 2ns screenshot, if you look at the output in the console, you'll see that it returen false 3 times for the self:hitTestPoint(event.x, event.y) variable before it returns true. Actually, this is the result if the 4th button is clicked. What actually happens, is that when you click a button, it seems to check the self:hitTestPoint(event.x, event.y) for all of the buttons above it, it returns false for those buttons and then returns true for the button clicked.

Why does it do this and is it a problem I need to fix?imageimage
864 x 341 - 21K
1165 x 607 - 58K


Sign In or Register to comment.