How to make a button that changes lamp energy in BGE? I am creating an options menu for a simple game. I want to make a button that will adjust my lamps energy up or down.

I would like both ways,  a button that adjust the lamp energy up and a way to adjust it down.
scene = bge.logic.getCurrentScene()
cont = bge.logic.getCurrentController()
light = scene.lights['Lamp']

if cont.sensors['Mouse1'].hitObject.name == 'button.up' and cont.sensors['Lclick'].getButtonStatus(bge.events.LEFTMOUSE) == bge.logic.KX_INPUT_JUST_ACTIVATED:
    light.energy += 0.5

if cont.sensors['Mouse1'].hitObject.name == 'button.down' and cont.sensors['Lclick'].getButtonStatus(bge.events.LEFTMOUSE) == bge.logic.KX_INPUT_JUST_ACTIVATED:
    light.energy -= 0.5


Attach this script to your two buttons with these logic bricks. The two buttons must be named button.down and button.up, or you will have to change the names in the script.


The two buttons will increase and decrease the default Lamp energy by 0.5 per click.