Game Development Community

Issues with platformer controls

by Dave Rushton · in Torque Game Builder · 07/31/2009 (4:32 pm) · 0 replies

The controls work great on the first level. When you load a new level and press one of these keys, the game crashes. We had to change the controls from level to level as a work around. The controls are a behavior attached to the player in TGB and loaded with the player when the scene is loaded.

This is the code I am using:
moveMap.bindObj(getWord(%this.jumpKey, 0), getWord(%this.jumpKey, 1), "jump", %this);
moveMap.bindObj(getWord(%this.leftKey, 0), getWord(%this.leftKey, 1), "moveLeft", %this);
moveMap.bindObj(getWord(%this.rightKey, 0), getWord(%this.rightKey, 1), "moveRight", %this);