Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Virtual Button Re-activation issue

Author
Message
Munchicken
Reviewed AGK on Steam
9
Years of Service
User Offline
Joined: 1st Aug 2015
Location: Texas
Posted: 17th May 2016 01:49
I'm having an issue with re-activating a virtual button. See the following code for a simple example. An example of usage in a game would be, one button for "Return to Game" and one for "Help". The "Return to Game" button would start inactive & invisible, then clicking "Help" would display the Help screen and activate & display the "Return to Game" button. Clicking the "Return to Game" button would hide the Help screen and deactivate & hide the "Return to Game" button.
The problem I'm seeing is that this logic works once, but the next time you click on "Help", the Help screen (w/ Return to Game button) flashes quickly then goes away.
Debug output shows me that the program registers a "phantom" click of the Return to Game button immediately after clicking the Help button.
I've tried adding Sleep statements to change the timing, with same results.
I also tried setting a game state that would skip one game loop after clicking Help. This helped a little, the problem still occurred, but slightly less often.
The issue does not occur if the re-activation is removed, so it appears to be caused by the second activation.

Sample code exhibiting issue:

Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 17th May 2016 10:45
Change GetVirtualButtonPressed to GetVirtualButtonReleased

And when activating button 2, disable button 1, and vice versa.
Munchicken
Reviewed AGK on Steam
9
Years of Service
User Offline
Joined: 1st Aug 2015
Location: Texas
Posted: 18th May 2016 00:20
Quote: "Change GetVirtualButtonPressed to GetVirtualButtonReleased"


Exactly what I needed! Thanks Mobiius
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 18th May 2016 09:09
No problems.

Login to post a reply

Server time is: 2024-09-29 13:21:54
Your offset time is: 2024-09-29 13:21:54