Hey again.
Now, i want to be presented with lets say three options; Start Game, Menu, and Credits. I've done this via create text, like so:
// Project: Making a screen Menu
// Created: 2015-03-22
// set window properties
SetWindowTitle( "Making a screen Menu" )
SetWindowSize( screenW, screenH, 0 )
global screenW = 1366
global screenH = 768
// set display properties
SetVirtualResolution( screenW, screenH )
SetOrientationAllowed( 1, 1, 1, 1 )
//Background colour
SetClearColor(50,50,100)
// Start Game
gameStart = CreateText("Start Game")
SetTextSize(gameStart,60)
SetTextPosition(gameStart,screenW / 2,100)
SetTextAlignment(gameStart,1)
//Options Menu
menu = CreateText("Menu")
settextsize(menu,60)
SetTextPosition(menu, screenW / 2, 200)
SetTextAlignment(menu,1)
//Credits
credits = CreateText("Credits")
SetTextSize(credits,60)
SetTextPosition(credits,screenW / 2, 300)
SetTextAlignment(credits,1)
Now i believe i've got the interaction down via the code:
if GetPointerPressed()=1 and GetTextHitTest (menu, GetPointerX (), GetPointerY ( ) )
endif
My problem is; i get the notification that i've physically clicked the 'Menu' text, but what would i do next to change screen? What i've been doing is something like:
if GetPointerPressed()=1 and GetTextHitTest (menu, GetPointerX (), GetPointerY ( ) )
setviewoffset(Something?,Something?)
endif
obviously 'something' is a placeholder. I've put in for example; screenW*2,screenH) which jumps to a blank screen, but i'm pretty sure i shouldn't be doing it like that lol.
Thanks again.
EDIT - I've changed the code, so that when i click; "Start Game", it deletes the text, and i suppose i could create other sprites in their place. This don't seem right though. Code in full so far:
// Project: Making a screen Menu
// Created: 2015-03-22
// set window properties
SetWindowTitle( "Making a screen Menu" )
SetWindowSize( screenW, screenH, 0 )
global screenW = 1366
global screenH = 768
// set display properties
SetVirtualResolution( screenW, screenH )
SetOrientationAllowed( 1, 1, 1, 1 )
//Background colour
SetClearColor(50,50,100)
// Start Game
gameStart = CreateText("Start Game")
SetTextSize(gameStart,60)
SetTextPosition(gameStart,screenW / 2,100)
SetTextAlignment(gameStart,1)
//Options Menu
menu = CreateText("Menu")
settextsize(menu,60)
SetTextPosition(menu, screenW / 2, 200)
SetTextAlignment(menu,1)
//Credits
credits = CreateText("Credits")
SetTextSize(credits,60)
SetTextPosition(credits,screenW / 2, 300)
SetTextAlignment(credits,1)
taptap = LoadMusic("taptap.mp3")
thud = LoadMusic("thud.mp3")
LoadImage(10,"floor.png")
SetSpriteSize(backdrop,screenW,screenH)
SetSpritePosition(backdrop,0,0)
do
if GetPointerPressed()=1 and GetTextHitTest (menu,GetPointerX (),GetPointerY ())
PlayMusic(taptap)
endif
if GetPointerPressed()=1 and GetTextHitTest (credits,GetPointerX (),GetPointerY ())
PlayMusic(thud)
endif
if GetPointerPressed()=1 and GetTextHitTest (gameStart,GetPointerX (),GetPointerY ())
PlayMusic(taptap)
backdrop = createsprite(10)
deletealltext()
endif
Sync()
loop
As you can see. I click 'Game Start' and i'm presented with a new backdrop, with all text now deleted. Is this the way it's suppose to be done? Rather than just jump to another point in the world.
Thanks again guys
Khadin