Making a hold switch?

I am making a maze game and need the character to push a block onto a switch to open a door, but I can’t figure out how to make it work.

touch sensor, set it to the block’s material, then message actuator to the door.
door message sensor, open on getting message.

what about when block get’s destroyed or moved off?

a new message for closing

how do I sense if it’s off? Inverted touch?

BUMP am I right with inverted touch?

Have you tried inverted touch sensor? Did it work?

no, not yet.

Why is it so hard to test your own ideas? Instead of posting and waiting for a response, you can easily figure things out for yourself just by messing around. Think of what you want to do, think of possible ways to do it, and then try them. The minute you stop needing forum approval for your ideas is the minute you become a smarter, faster, game designer.

On a more related note, you can look at my game Cube (the BGE contest logicbrick winner) for a way that I implemented this sort of switch. The example is on level 2, where you have to get the enemy cubes to stay on the button in order to advance through the level.

-Sam

Here’s a simple example of what I think you’re trying to do:

Attachments

switch.blend (130 KB)

@sam I wans’t able to get on a computer with Blender until today.

@extra thanks

I did test it after I posted but when I tried to come back and edit my post BA wouldn’t load. I’ll look at Cube and see.

EDIT: Thanks Sam! I don’t even need message apparently.

Sam am I missing something? My switch works where ever my “key” is touching it.

BUMP

I really am sorry about this.

EDIT: I put a plane on top of the button and gave the plane the bricks and now it seems to work.

EDIT2: figured out I couldn’t get my block on top of the button since it can’t jump :slight_smile: so went to a plane on the floor of my maze but now when my key is on it then the door opens then closes again and repeats.

example blend. Blue plane is the switch red is door open is down closed is up. Player has a beak so you know which way it’s faced. Mouselook left and right. W forward S backwards. Key property. I see no reason for it to be bouncing like that. It also appears to do this with my player on top on button way to same if I spawn a key on either.

Attachments

example.blend (158 KB)