Dear users, I've a problem
I've started a simple game, but first of all I've a problem with the menu. There's a intro screen with some strings on it, then if the player touch the display, the game goes to the second screen. The problem is that strings in the previous screen aren't cleared. The string of the second screen is displayed above the previous ones! I'd need a total clear of the strings of the first screen.
Could you help me?
Here a code snippet
thanks so much!
do
select machine_state:
case 0:
TitleScreen()
endcase
case 1:
OptionMenu()
endcase
endselect
loop
function TitleScreen()
// load background
Title_background = CreateSprite ( LoadImage ( "backgrounds/menuscreen.png" ) )
ID1 = 0
ID2 = 0
ID3 = 0
TitleString$ = "Myself presents"
ID1 = CreateText(TitleString$)
SetTextColor(ID1, 0, 0, 0, 255)
SetTextSize(ID1,60)
SetTextPosition(ID1,100,50)
TitleString2$ = "Testgame 1"
ID2 = CreateText(TitleString2$)
SetTextColor(ID2, 255, 0, 0, 255)
SetTextSize(ID2,70)
SetTextPosition(ID2,150,300)
TitleString3$ = "Touch the display"
ID3 = CreateText(TitleString3$)
SetTextColor(ID3, 0, 0, 255, 255)
SetTextSize(ID3,40)
SetTextPosition(ID3,180,450)
while GetPointerPressed ( ) = 0
Print( ScreenFPS() )
Print(Machine_state)
Sync()
endwhile
machine_state = 1
endfunction
function OptionMenu()
ClearScreen()
Swap()
ID4 = 0
TitleString4$ = "Opzioni"
ID4 = CreateText(TitleString4$)
SetTextColor(ID4, 0, 0, 0, 255)
SetTextSize(ID4,60)
SetTextPosition(ID4,100,50)
// load background
Option_background = CreateSprite ( LoadImage ( "backgrounds/menuscreen.png" ) )
while GetPointerPressed ( ) = 0
Print( ScreenFPS() )
Print(Machine_state)
Sync()
endwhile
machine_state = 1
endfunction