turning on a light?

I need a light to turn on when a character passes through an object in 2.57 BGE. Is it possible to do that? The lights need to remain off until the character reaches a check point! Any help would be appreciated!

This is not tested, but put an always logic block on the light, and make it visible off. Then when triggered, change to visible on.
Or else add and remove object may work.

Where do you get to logic bricks? And what do you mean by triggered? I like your train of thought but don’t quite understand what you mean…

Nevermind on the how to get to logic bricks, I misunderstood. I am trying to test out your first idea but its not working. Also I need the light to somehow be triggered by “a character moving through an object”. Not quite sure what to do… :frowning:

Adding an empty and using add object works for me. While having a lamp on layer 2. However this probably isn’t the best way of doing it.
So hopefully someone will come up with a better idea using property for 0 and 1 to turn on and off.

why not just setup a toggle visible switch, so that as the character passes a point it is automatically toggled visible?
that would help make it so that you would have to pass a checkpoint for it

Lamp= Off if character isnt past certain point
toggle lamp on after that certain point.

thats not python or anything, I was just showing my idea :stuck_out_tongue: but it would probably be easier to do it in python

How do you set that up? Which logic bricks do I use?

Fayt, for some reason I can’t seem to get add object to work. I’ve tried the near and collision sensors hooked to the and then to add object (which I then put in the object), and it didn’t work. I have the light on the second layer. and evil moon MOose I haven’t found how to get the results your talking about with the logic bricks, although it seems simple enough I’m not sure if what your saying is available without python…

You have to use an empty on layer 1, use that to add object, and make the light on layer 2. The empty will be where the light is added to.
However if you don’t have a property or something to add only once, it will add dozens of them if you keep doing it.

So toggling the visibility would be best. I don’t work with near sensors, so I wouldn’t be much help there.

here goes a .blend
hold/press space.

if you want to make it immediate, then make it a one frame change.


light.blend (419 KB)

Ziauddin this works good but I need to have the light turn on when the character hits a checkpoint. It has to be off until the checkpoint, and when turned on it needs to remain on, and it needs to be automatic like a collision of some sort, so pushing the space bar can’t happen… Any suggestions?

use collision sensor, or near sensor.
if you can’t figure this out too, tell me.

It is possible with only logic bricks, you have a toggle visible switch on one of them, cant remember which one though :P…then just set a timer, or a area of focus

This is what I was able to come up with. I"m slightly new to blender so it may not be the best way to go about something like this, but it will work for now. Feel free to play around with it and if anybody comes up with something that doesn’t involve having the lights on different layers or something let me know! Thanks for all your guys help!!

Checkpoint_Light.blend (441 KB)

hello james, owing to a slow connection i couldn’t download your blend but u might want to look at this it is just a modification of ziauddin’s blend file,using a ray sensor . press up arrow key to move the red cube up,the light goes off near the white cube.
also note that one raysensor will act on only one axis.this is the .blend
light.blend (437 KB)

Hash, instead of having it on and turn off when near the ray how could I have the light off and then turn on when near. Also it would have to remain on after its triggered. I have it so that the “edit object” actuator is adding a light. But I don’t know if thats the best way. Specially if I were to try and program it using game kit to play on an android. For free of course :smiley: Also hash feel free to download when able and see what I’m trying to accomplish… It way help you figure something else out that is more functional.