You need to put your button-checking routine in the game loop (do/loop)
AGK is not event-driven, so you can't tell it to do something once. It needs to be instructed every loop.
width = GetDeviceWidth ( )
height = GetDeviceHeight ( )
SetWindowTitle( "Don't let go!" )
SetScreenResolution( width, height )
SetOrientationAllowed( 1, 0, 0, 0 )
loadimage(1,"Sbutton.jpg")
loadimage(2,"Tbutton.jpg")
loadimage(3,"bg.jpg")
//bg
createsprite(1,3)
setspritesize(1,100,100)
// solo button
AddVirtualButton( 1, 25, 80, 30)
SetVirtualButtonAlpha(1,255)
SetVirtualButtonImageUp(1,1)
SetVirtualButtonImagedown(1,1)
SetVirtualButtonActive(1,1)
//two player button
AddVirtualButton( 2, 75, 80, 30)
SetVirtualButtonAlpha(1,255)
SetVirtualButtonImageUp(2,2)
SetVirtualButtonImagedown(2,2)
SetVirtualButtonActive(2,1)
//solo play
do
if GetVirtualButtonreleased(1)
SetVirtualButtonVisible( 1, 0 )
SetVirtualButtonVisible( 2, 0 )
endif
Sync()
loop
Quidquid latine dictum sit, altum sonatur