How to bind keys with the level editor?
by Philip Mansfield · in Torque Game Builder · 05/16/2006 (12:33 pm) · 3 replies
I've run into a bit of an odd problem. I've got script in my games main.cs file that binds my keyboard commands:
Then in game.cs I push the action map:
When I click the Play Level button, none of my binds actually work. If I push the actionmap from the console, I get no errors, but the keys still don't work. If I click Edit -> Preferences, I can see the function names at the top of the keybindings list that should be called, but they have no keys assigned to them.
I'm sure it's something daft that I'm doing, but I have no idea what it is. Any light that can be shone on the problem would be greatly appreciated :)
function setupKeybinds()
{
// define the controls for the Follow the Lights game
if( isObject(moveMap) )
moveMap.delete();
new ActionMap(moveMap);
moveMap.bind(keyboard, "r", "flashRed");
moveMap.bind(keyboard, "g", "flashGreen");
moveMap.bind(keyboard, "b", "flashBlue");
moveMap.bind(keyboard, "y", "flashYellow");
moveMap.bind(keyboard, "p", "playFollowLights");
}Then in game.cs I push the action map:
function startGame(%level)
{
// Set The GUI.
Canvas.setContent(mainScreenGui);
Canvas.setCursor(DefaultCursor);
sceneWindow2D.loadLevel(%level);
// initialise the High Score
$highScore = 0;
// start the demo mode
moveMap.push();
initDemoMode();
}When I click the Play Level button, none of my binds actually work. If I push the actionmap from the console, I get no errors, but the keys still don't work. If I click Edit -> Preferences, I can see the function names at the top of the keybindings list that should be called, but they have no keys assigned to them.
I'm sure it's something daft that I'm doing, but I have no idea what it is. Any light that can be shone on the problem would be greatly appreciated :)
Torque 3D Owner Rodney Rindels - Torqued
Divide By Zero