Ok This is just a basic regular easy menu set up
I do not see any problems, it is odd because this worked on my phone last week.
Note: When I take out GetPointerPressed() it works, but I need it to only load when the pointer is pressed.
function Menu()
DeleteAllText()
DeleteAllImages()
DeleteAllSprites()
DeleteSlider("Music")
DeleteSlider("Sound Effects")
for allsounds=0 to 500000
if GetSoundExists(allsounds)=1 then DeleteSound(allsounds)
next allsounds
for allmusic=0 to 500000
if GetMusicExistsOGG(allmusic)=1 then DeleteMusicOGG(allmusic)
next allmusic
Lost_Game=0
#include "Slider.agc"
MenuBackGroundImage=LoadImage("zombie5 icon_no_bg.png")
MenuBackGround=CreateSprite(MenuBackGroundImage)
SetSpriteScale(MenuBackGround,0.1,0.1)
SetSpritePositionByOffset(MenuBackGround,50,50)
OptionsBackGroundImage=LoadImage("Skills.png")
OptionsBackGround=createsprite(OptionsBackGroundImage)
SetSpriteScale(OptionsBackGround,0.05,0.05)
SetSpritePositionByOffset(OptionsBackGround,50,50)
PlayButton=loadimage("PlayGame.png")
SettingsButton=loadimage("Settings.png")
closebutton=loadimage("close.png")
PlayGame=Createsprite ( PlayButton )
SetSpriteScale ( PlayGame, 0.06,0.06)
SetSpritePositionByOffset ( PlayGame,10,70)
SetspriteDepth(PlayGame,1)
SetspriteVisible(PlayGame,1)
GameOptions=Createsprite ( SettingsButton )
SetSpriteScale ( GameOptions, 0.06,0.06)
SetSpritePositionByOffset ( GameOptions,10,80)
SetspriteDepth(GameOptions,1)
SetspriteVisible(GameOptions,1)
CloseOptions=Createsprite ( closebutton )
SetSpriteScale ( CloseOptions, 0.01,0.01)
SetSpritePositionByOffset ( CloseOptions,68,84)
SetspriteDepth(CloseOptions,1)
SetspriteVisible(CloseOptions,0)
Menu_Tital_Egypt_Image=LoadImage("ejypt.png")
Menu_Tital_Versus_Image=LoadImage("vs.png")
Menu_Tital_Zombies_Image=LoadImage("zombies.png")
Menu_Egypt=createsprite(Menu_Tital_Egypt_Image)
SetSpriteScale ( Menu_Egypt, 0.1,0.1)
SetSpritePositionByOffset ( Menu_Egypt,50,-60)
SetspriteDepth(Menu_Egypt,1)
SetspriteVisible(Menu_Egypt,1)
SetSpritePhysicsOn ( Menu_Egypt, 2 )
Menu_Versus=createsprite(Menu_Tital_Versus_Image)
SetSpriteScale ( Menu_Versus, 0.1,0.1)
SetSpritePositionByOffset ( Menu_Versus,49,-50)
SetspriteDepth(Menu_Versus,1)
SetspriteVisible(Menu_Versus,1)
SetSpritePhysicsOn ( Menu_Versus, 2 )
Menu_Zombies=createsprite(Menu_Tital_Zombies_Image)
SetSpriteScale ( Menu_Zombies, 0.1,0.1)
SetSpritePositionByOffset ( Menu_Zombies,49,-40)
SetspriteDepth(Menu_Zombies,1)
SetspriteVisible(Menu_Zombies,1)
SetSpritePhysicsOn ( Menu_Zombies, 2 )
Bar=createsprite(0)
SetSpriteScale ( Bar, 100,0.1)
SetSpritePositionByOffset ( Bar,50,51)
SetSpritePhysicsOn ( Bar, 1 )
SetSpriteVisible(Bar,0)
TouchSound=loadsound("ActivateBeep.wav")
// must be called before any other slider functions
InitSliders()
// create some sliders
// name, min, max, x position, y position
CreateSlider("Music", 0, 100, 40, 43)
SetSliderValue("Music", 4)
CreateSlider("Sound Effects", 0, 100, 40, 63)
SetSliderValue("Sound Effects", 4)
LogoImage=LoadImage("logo_red.png")
Logo=CreateSprite(LogoImage)
SetSpriteScale(Logo,0.07,0.07)
SetSpritePositionByOffset(Logo,85,80)
Menu_Music=LoadMusicOGG("Farzad Farhangi - Mastika.ogg")
CreateEditBox( 1 )
SetEditBoxBorderSize( 1, 0.5 )
SetEditBoxBorderColor( 1, 0, 0, 0, 255 )
SetEditBoxMaxChars( 1,8 )
SetEditBoxPosition( 1, 2, 30 )
SetEditBoxSize( 1, 13, 5)
SetEditBoxTextSize( 1, 10 )
SetEditBoxCursorWidth( 1, 0.3 )
SetEditBoxCursorPosition( 1,5)
SetEditBoxScissor( 1, 0, 0, 0, 0 )
FixEditBoxToScreen ( 1, 1 )
SetEditBoxPosition( 1, 5, 30 )
Name_text=CreateText ( "Enter Name" )
SetTextPosition ( Name_text,5.5, 30)
SetTextSize ( Name_text, 5 )
FixTextToScreen ( Name_text, 1 )
SetTextColor(Name_text,0,0,0,255)
x# = GetPointerX ( )
y# = GetPointerY ( )
Pressed=GetPointerPressed()
Released=GetPointerReleased()
Wrote_Name=GetEditBoxCursorPosition( 1 )
Name$= GetEditBoxText( 1 )
SetEditBoxText( 1, Name$ )
if GettextHitTest( Name_text, x#, y# ) =1 and pressed=1 then edit=1
Print_warning_text_1=CreateText ( "No file for given name" )
SetTextPosition ( Print_warning_text_1,2,30)
SetTextSize ( Print_warning_text_1, 8 )
FixTextToScreen ( Print_warning_text_1, 1 )
SetTextColorAlpha ( Print_warning_text_1, 255 )
SetTextDepth(Print_warning_text_1,1)
SetTextVisible(Print_warning_text_1,0)
Print_warning_text_2=CreateText ( "Enter Your Name To Play" )
SetTextPosition ( Print_warning_text_2,30,60)
SetTextSize ( Print_warning_text_2, 8 )
FixTextToScreen ( Print_warning_text_2, 1 )
SetTextColor ( Print_warning_text_2,190,255,0,255 )
SetTextDepth(Print_warning_text_2,1)
SetTextVisible(Print_warning_text_2,0)
Player_save_text=CreateText ( "Saved Game=" )
SetTextPosition ( Player_save_text,23,20)
SetTextSize ( Player_save_text, 5 )
FixTextToScreen ( Player_save_text, 1 )
SetTextColorAlpha ( Player_save_text, 255 )
SetTextDepth(Player_save_text,1)
SetTextVisible(Player_save_text,0)
Player_Delete_text=CreateText ( "Press to delete saved game" )
SetTextPosition ( Player_Delete_text,10,25)
SetTextSize ( Player_Delete_text, 5 )
FixTextToScreen ( Player_Delete_text, 1 )
SetTextColorAlpha ( Player_Delete_text, 255 )
SetTextDepth(Player_Delete_text,1)
SetTextVisible(Player_Delete_text,0)
path as string
path = GetWritePath()+"media"
folderID = OpenRawFolder( path )
folderCount = GetRawFolderNumFolders(folderID)
fileCount = GetRawFolderNumFiles(folderID)
video=LoadVideo( "2.mp4" )
videoimage=1000
PlayVideoToImage( videoimage )
videosprite = createSprite(videoimage)
vidmaskshader = LoadspriteShader("alphavid.ps")
SetShaderConstantByName(vidmaskshader , "_cutoff_level",0.56,0.0,0.0,0)
SetSpriteShader(videosprite,vidmaskshader)
SetSpriteSize(videosprite,42,42)
SetSpritePosition(videosprite,25,60)
SetSpriteDepth(videosprite,0)
do
SetTextVisible(Demo,0)
if getvideoplaying()=0 or GetPointerPressed()=1
SetSpriteVisible(videosprite,0)
DeleteSprite(videosprite)
deletevideo()
DeleteShader(vidmaskshader)
endif
spritey= GetSpriteY( Menu_Egypt )
spritex= GetSpriteX( Menu_Egypt )
SetPhysicsGravity ( 0, 60.0)
if GetMusicPlayingOGG(Menu_Music)=0 then PlayMusicOGG(Menu_Music,1)
SetMusicSystemVolumeOGG( GetSliderValue("Music") )
///////////////////////////////////////////////////////////////////////////////////////////
// Regular Menu
///////////////////////////////////////////////////////////////////////////////////////////
HitPlay=GetspriteHitTest (PlayGame, GetPointerX ( ), GetPointerY ( ) )
Hitlogo=GetSpriteHitTest (Logo, GetPointerX ( ), GetPointerY ( ) )
If Hitlogo=1
OpenBrowser( "https://www.appgamekit.com/")
MinimizeApp()
endif
SetEditBoxActive(1,1)
if HitPlay=1 and Options=0
SetspriteColor(PlayGame,200,200,200,255)
if clickOnce2=0
ClickSound=PlaySound(TouchSound,GetSliderValue("Sound Effects"),0)
clickOnce2=1
endif
else
SetspriteColor(PlayGame,255,255,255,255)
clickOnce2=0
endif
Wrote_Name=GetEditBoxCursorPosition( 1 )
Name$= GetEditBoxText( 1 )
if Wrote_Name=0 then SetTextVisible(Name_text,1)
if Wrote_Name>0 then SetTextVisible(Name_text,0)
if GetPointerPressed()=1 and HitPlay=1 and Wrote_Name<4 and Options=0
Setwarning=1
endif
if GetPointerPressed()=1 and HitPlay=0 and Wrote_Name<4
Setwarning=0
endif
if Setwarning=0
SetTextVisible(Print_warning_text_2,0)
endif
if Setwarning=1
SetTextVisible(Print_warning_text_2,1)
endif
if GetPointerPressed()=1 and HitPlay=1 and Wrote_Name>4 and Options=0
for x=0 to 1
SetSpriteVisible(_sliderResource.sliderList[x].sprBar, 0)
SetSpriteVisible(_sliderResource.sliderList[x].sprHandle, 0)
SetTextVisible(_sliderResource.sliderList[x].txtLabel ,0)
SetTextVisible(_sliderResource.sliderList[x].txtValue ,0)
SetSpriteVisible(OptionsBackGround,0)
next x
DeleteSound(TouchSound)
DeleteSprite(MenuBackGround)
DeleteImage(MenuBackGroundImage)
Deletesprite(PlayGame)
DeleteImage(PlayButton)
DeleteText(Print_warning_text_2)
DeleteSprite(Logo)
DeleteImage(LogoImage)
StopMusicOGG(Menu_Music)
DeleteMusic(Menu_Music)
deletetext(Name_text)
Deletesprite(Menu_Egypt)
Deletesprite(Menu_Versus)
Deletesprite(Menu_Zombies)
Deletesprite(Bar)
SetEditBoxText( 1, Name$ )
DeleteEditBox(1)
SetSpriteVisible(videosprite,0)
deletevideo()
DeleteShader(vidmaskshader)
Save_last_Player()
Save_Game()
gosub JumpToGame
endif
///////////////////////////////////////////////////////////////////////////////////////////
// Options Menu
///////////////////////////////////////////////////////////////////////////////////////////
HitOptions=GetspriteHitTest (GameOptions, GetPointerX ( ), GetPointerY ( ) )
HitOptionsimg=GetspriteHitTest (CloseOptions, GetPointerX ( ), GetPointerY ( ) )
if HitOptions=1 and Options=0
SetspriteColor(GameOptions,200,200,200,255)
if clickOnce=0
ClickSound=PlaySound(TouchSound,GetSliderValue("Sound Effects"),0)
clickOnce=1
endif
else
SetspriteColor(GameOptions,255,255,255,255)
clickOnce=0
endif
if GetPointerPressed()=1 and HitOptions=1 then inc Options,1
if Options>1 then options=0
if Options=1 then HandleSliders()
if Options=0
for x=0 to 1
SetSpriteVisible(_sliderResource.sliderList[x].sprBar, 0)
SetSpriteVisible(_sliderResource.sliderList[x].sprHandle, 0)
SetTextVisible(_sliderResource.sliderList[x].txtLabel ,0)
SetTextVisible(_sliderResource.sliderList[x].txtValue ,0)
SetSpriteVisible(OptionsBackGround,0)
SetspriteVisible(closebutton,0)
SetspriteVisible(Menu_Egypt,1)
SetspriteVisible(Menu_Versus,1)
SetspriteVisible(Menu_Zombies,1)
next x
endif
if Options=1
SetEditBoxActive(1,0)
for x=0 to 1
SetSpriteVisible(_sliderResource.sliderList[x].sprBar, 1)
SetSpriteVisible(_sliderResource.sliderList[x].sprHandle, 1)
SetTextVisible(_sliderResource.sliderList[x].txtLabel ,1)
SetTextVisible(_sliderResource.sliderList[x].txtValue ,1)
SetSpriteVisible(OptionsBackGround,1)
SetspriteVisible(closebutton,1)
next x
SetspriteVisible(Menu_Egypt,0)
SetspriteVisible(Menu_Versus,0)
SetspriteVisible(Menu_Zombies,0)
endif
if HitOptionsimg=1 and GetPointerPressed()=1 then Options=0
Sync()
loop
endfunction