- Code: Select all
obj = 0 -- | Define a variable for our object ID
entname =0; -- | Define a variable for the entity name
fpstut =0; -- | Define a variable for the tutorial GUI
function onInit(objID)
obj = objID;
gui.workSpace("tutorial/fps/");
fpstut = gui.load("fpstut_container.rml",0,0);
gui.hide(fpstut,fpstut);--hide this screen for now
gui.hideCursor();--hide cursor as it shows if not used, still does not work
end
function onTrigger_Enter(hitID)
entname = entity.getEntityName(hitID);
if(entname == "Player")then --If the player enters the trigger then go to pause game state.
sky.setGameState(enum.GS_GamePaused());
end
end
function tutButtonEvent(Btn) --when the exit button of the gui is pressed hide gui and cursor
if (Btn == "exit") then
--gui.hide("fpstut","fpstut"); --gui.hideCursor(); -- hide the gui and cursor in exit of pause state.
sky.setGameState(enum.GS_GameMain()); -- exit pause state and enter main game state.
end
end
function onEnter( )
sky.lprint("Main Entered");
end
function onEnter_GamePaused( ) -- On entering the paused game state show gui and show cursor
sky.lprint("Paused Entered");
gui.show("fpstut","fpstut");
gui.showCursor();
end
function onExit( )
sky.lprint("Main Exit");
end
function onExit_GamePaused( ) -- On exiting the paused game state hide gui and show cursor
sky.lprint("Exit Paused ");
gui.hide("fpstut","fpstut"); -- hide gui
gui.hideCursor(); -- hide cursor
end
when the player enters the trigger the game should go into a paused game state and a gui should be displayed and the cursor should be displayed.
when the exit button on the gui is pushed it should leave the paused state and enter the main game state, then it should hide the gui and cursor (well thats what I have been trying to do lol )but I get the error below and it does'nt work.
I know the path thing is messed up but it usually works when compiled and run to get around that error.
LUA ERROR: entity.callFn(..) failed. missing arg2 Target ID is invalid
and when exiting
_____________________________________________________________
|
| < GAME STOPPING >
|_____________________________________________________________
Main Exit
Main Entered
Main Entered
Main Entered
Main Entered
Main Entered