Lever opening door does not function as expected


I build a little platformer and there are a number of levers that you need to push with “e” to open doors. They all worked fine, but after I added another door and key for yet another door, it stopped functioning for the first and second door.

I have positioned the character at the first lever in question for testing purposes:


I am using two raycasts upon pressing “e” to check if the character is close enough to a lever to send messages for the door to open and the lever have its animation.

Any ideas why it does not work anymore?

Hey @GwyD - maybe a proximity would be better than a raycast here. I looked at the first level, and it appears that that the issue is that the ray is casting at 180 degrees. This means the ray only hits if the player is facing away from the switch.

Thanks, but that is the strange thing, there are two raycasts for front and back. But it does work facing away from the switch and does not when facing it at 0 degree or 359 degree…

@GwyD - Sorry, I didn’t look closely enough when I checked it out. I think you may be running into a bug with the Polygon/Ray interaction in the Flash version of the engine. You can try changing the collision type to “circle” to see if that helps. Alternatively, you could try using the new HTML5 version that will soon be replacing the old Flash one. To do that, just click the small “html5” link next to the game o your “My Games” page.