You would use the same code … replace the trigger event with your key event … if you have a controller the key event needs to be in there and call an event on your player … if you have no controller then just use the event in the player.
It would be the same code, just not using the Box Trigger.