______________MATTER RESOLVED - FILES REMOVED_________________
Hey once again fellow AppGameKit developers, I am in need of some help. So to add some animation to a main menu of my current project, I decided to make the screen like swipe in a direction moving all the sprites in direction XYZ and then revealing the chosen option.
Problem is that for some reason if I press the "settings" button before I have pressed the "how to play" button, it glitches, but if I restart and press the "how to play" button first, then the settings button works fine!?
I am doing the movement with four different functions which look like this:
// Function for "swiping" the main menu sprites left, giving us a view of the options-screen sprites.
function MenuSwipeLeft ( S1 , S1h , S2 , S3 , S4 , S5 , Si1 )
setsyncrate ( 600 , 0 )
S1X = getspriteX ( S1 )
S1Y = getspriteY ( S1 )
S1hX = getspriteX ( S1h )
S1hY = getspriteY ( S1h )
S2X = getspriteX ( S2 )
S2Y = getspriteY ( S2 )
S3X = getspriteX ( S3 )
S3Y = getspriteY ( S3 )
S4X = getspriteX ( S4 )
S4Y = getspriteY ( S4 )
S5X = getspriteX ( S5 )
S5Y = getspriteY ( S5 )
setspriteposition ( Si1 , 100 , 0 )
setspritevisible ( Si1 , 1 )
Si1X = getspriteX ( Si1 )
Si1Y = getspriteY ( Si1 )
for i = 0 to 600
setspriteposition ( S1 , S1X - i*1.6666666/10 , S1Y )
setspriteposition ( S1h , S1hX - i*1.6666666/10 , S1hY )
setspriteposition ( S2 , S2X - i*1.6666666/10 , S2Y )
setspriteposition ( S3 , S3X - i*1.6666666/10 , S3Y )
setspriteposition ( S4 , S4X - i*1.6666666/10 , S4Y )
setspriteposition ( S5 , S5X - i*1.6666666/10 , S5Y )
setspriteposition ( Si1 , Si1X - i*1.6666666/10 , Si1Y )
sync ()
next i
setspritevisible ( S1 , 0 )
setspritevisible ( S1h , 0 )
setspritevisible ( S2 , 0 )
setspritevisible ( S3 , 0 )
setspritevisible ( S4 , 0 )
setspritevisible ( S5 , 0 )
setsyncrate ( 60 , 0 )
endfunction
// Function for "swiping" the options sprites to the right giving us a view of the main menu.
function MenuSwipeRight ( S1 , S1h , S2 , S3 , S4 , S5 , Si1 )
setsyncrate ( 600 , 0 )
S1X = getspriteX ( S1 )
S1Y = getspriteY ( S1 )
S1hX = getspriteX ( S1h )
S1hY = getspriteY ( S1h )
S2X = getspriteX ( S2 )
S2Y = getspriteY ( S2 )
S3X = getspriteX ( S3 )
S3Y = getspriteY ( S3 )
S4X = getspriteX ( S4 )
S4Y = getspriteY ( S4 )
S5X = getspriteX ( S5 )
S5Y = getspriteY ( S5 )
setspritevisible ( S1 , 1 )
setspritevisible ( S1h , 1 )
setspritevisible ( S2 , 1 )
setspritevisible ( S3 , 1 )
setspritevisible ( S4 , 1 )
setspritevisible ( S5 , 1 )
Si1X = getspriteX ( Si1 )
Si1Y = getspriteY ( Si1 )
for i = 0 to 600
setspriteposition ( S1 , S1X + i*1.6666666/10 , S1Y )
setspriteposition ( S1h , S1hX + i*1.6666666/10 , S1hY )
setspriteposition ( S2 , S2X + i*1.6666666/10 , S2Y )
setspriteposition ( S3 , S3X + i*1.6666666/10 , S3Y )
setspriteposition ( S4 , S4X + i*1.6666666/10 , S4Y )
setspriteposition ( S5 , S5X + i*1.6666666/10 , S5Y )
setspriteposition ( Si1 , Si1X + i*1.6666666/10 , Si1Y )
sync ()
next i
setspritevisible ( Si1 , 0 )
setsyncrate ( 60 , 0 )
endfunction
// Function for "swiping" the main menu up, showing the how to play screen.
function MenuSwipeUp ( S1 , S1h , S2 , S3 , S4 , S5 , Si1 )
setsyncrate ( 600 , 0 )
S1X = getspriteX ( S1 )
S1Y = getspriteY ( S1 )
S1hX = getspriteX ( S1h )
S1hY = getspriteY ( S1h )
S2X = getspriteX ( S2 )
S2Y = getspriteY ( S2 )
S3X = getspriteX ( S3 )
S3Y = getspriteY ( S3 )
S4X = getspriteX ( S4 )
S4Y = getspriteY ( S4 )
S5X = getspriteX ( S5 )
S5Y = getspriteY ( S5 )
setspriteposition ( Si1 , 0 , 100 )
setspritevisible ( Si1 , 1 )
Si1X = getspriteX ( Si1 )
Si1Y = getspriteY ( Si1 )
for i = 0 to 600
setspriteposition ( S1 , S1X , S1Y - i*1.6666666/10 )
setspriteposition ( S1h , S1hX , S1hY - i*1.6666666/10 )
setspriteposition ( S2 , S2X , S2Y - i*1.6666666/10 )
setspriteposition ( S3 , S3X , S3Y - i*1.6666666/10 )
setspriteposition ( S4 , S4X , S4Y - i*1.6666666/10 )
setspriteposition ( S5 , S5X , S5Y - i*1.6666666/10 )
setspriteposition ( Si1 , Si1X , Si1Y - i*1.6666666/10 )
sync ()
next i
setspritevisible ( S1 , 0 )
setspritevisible ( S1h , 0 )
setspritevisible ( S2 , 0 )
setspritevisible ( S3 , 0 )
setspritevisible ( S4 , 0 )
setspritevisible ( S5 , 0 )
setsyncrate ( 60 , 0 )
endfunction
// Function for "swiping" the how to play screen down, showing the main menu.
function MenuSwipeDown ( S1 , S1h , S2 , S3 , S4 , S5 , Si1 )
setsyncrate ( 600 , 0 )
S1X = getspriteX ( S1 )
S1Y = getspriteY ( S1 )
S1hX = getspriteX ( S1h )
S1hY = getspriteY ( S1h )
S2X = getspriteX ( S2 )
S2Y = getspriteY ( S2 )
S3X = getspriteX ( S3 )
S3Y = getspriteY ( S3 )
S4X = getspriteX ( S4 )
S4Y = getspriteY ( S4 )
S5X = getspriteX ( S5 )
S5Y = getspriteY ( S5 )
setspritevisible ( S1 , 1 )
setspritevisible ( S1h , 1 )
setspritevisible ( S2 , 1 )
setspritevisible ( S3 , 1 )
setspritevisible ( S4 , 1 )
setspritevisible ( S5 , 1 )
setspritevisible ( Si1 , 1 )
Si1X = getspriteX ( Si1 )
Si1Y = getspriteY ( Si1 )
for i = 0 to 600
setspriteposition ( S1 , S1X , S1Y + i*1.6666666/10 )
setspriteposition ( S1h , S1hX , S1hY + i*1.6666666/10 )
setspriteposition ( S2 , S2X , S2Y + i*1.6666666/10 )
setspriteposition ( S3 , S3X , S3Y + i*1.6666666/10 )
setspriteposition ( S4 , S4X , S4Y + i*1.6666666/10 )
setspriteposition ( S5 , S5X , S5Y + i*1.6666666/10 )
setspriteposition ( Si1 , Si1X , Si1Y + i*1.6666666/10 )
sync ()
next i
setspritevisible ( Si1 , 0 )
setsyncrate ( 60 , 0 )
endfunction
And I call them like so:
//DEV TEST CODE *******REMOVE LATER*********
If getpointerpressed ( ) = 1
If GetSpriteHitTest( MH_tt , GetPointerX ( ) , GetPointerY ( ) ) = 1
playsound ( 2 )
MenuSwipeDown ( MM_htp_btn , MM_htp_H_btn , MM_settings_btn , MM_play_btn , MM_exit_btn , MM_tt , MH_tt )
endif
endif
If getpointerpressed ( ) = 1
If GetSpriteHitTest( MO_tt , GetPointerX ( ) , GetPointerY ( ) ) = 1
playsound ( 2 )
MenuSwipeRight ( MM_settings_btn , MM_settings_H_btn , MM_play_btn , MM_htp_btn , MM_exit_btn , MM_tt , MO_tt )
endif
endif
//***************************AND LIKE THIS**********************
//Settings button
If getpointerpressed ( ) = 1
If GetSpriteHitTest( MM_settings_btn , GetPointerX ( ) , GetPointerY ( ) ) = 1
playsound ( 2 )
MenuSwipeLeft ( MM_settings_btn , MM_settings_H_btn , MM_play_btn , MM_htp_btn , MM_exit_btn , MM_tt , MO_tt )
endif
endif
//How to play button
If getpointerpressed ( ) = 1
If GetSpriteHitTest( MM_htp_btn , GetPointerX ( ) , GetPointerY ( ) ) = 1
playsound ( 2 )
MenuSwipeUp ( MM_htp_btn , MM_htp_H_btn , MM_settings_btn , MM_play_btn , MM_exit_btn , MM_tt , MH_tt )
endif
endif
I have attached my project, PLEASE NOTE THAT TO REVERT TO THE MAIN MENU, YOU SIMPLY CLICK THE SCREEN.
Thanks
//Anton[b][/b]