//--------------------------------------------------------------------------------------------- // Torque Game Builder // Copyright (C) GarageGames.com, Inc. //--------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------- // startGame // All game logic should be set up here. This will be called by the level builder when you // select "Run Game" or by the startup process of your game to load the first level. //--------------------------------------------------------------------------------------------- function startGame(%level) { Canvas.setContent(mainScreenGui); Canvas.setCursor(DefaultCursor); new ActionMap(moveMap); moveMap.bindCmd(keyboard, "f1", "removeBackground();", ""); moveMap.bindCmd(keyboard, "f9", "toggleFPS();", ""); moveMap.push(); $enableDirectInput = true; activateDirectInput(); enableJoystick(); toggleFullScreen(); sceneWindow2D.loadLevel(%level); %worldSize = sceneWindow2D.getCurrentCameraSize(); $worldSizeX = getWord(%worldSize, 0); $worldSizeY = getWord(%worldSize, 1); $scaleunit = marker.getSizeX()/5; grass.setUseTouchEvents(true); // sun.setUseTouchEvents(true); } function toggleFPS(){ if($fps_enabled) metrics(""); else metrics("fps"); $fps_enabled = !$fps_enabled; } //--------------------------------------------------------------------------------------------- // endGame // Game cleanup should be done here. //--------------------------------------------------------------------------------------------- function endGame() { sceneWindow2D.endLevel(); moveMap.pop(); moveMap.delete(); }