Activate when collision goes out

In my game I want something to activate when you touch it but turn off when you stop touching it. It uses an always function which is what is messing me uo.

1 Like

I COULD probably use raycasts to do it but I’m still curious if there’s I way to do the collisions thing.

1 Like

Can you send a screenshot of what you’re trying to do with this code?

Uhhhhh I dont know how to take a screenshot on my school chromebook. It’s an always function and a collision function attached to a switch. I’m trying to make a gust of wind that when you are in it it blows you back a bit.

Unless ur school put some bogus restrictions, you should be able to take one from the capture button on the bottom right-hand corner of the screen (around where the time of day and calendar show up)

1 Like

Screenshot 2023-11-15 9.52.43 AM

Since ‘Collision’ doesn’t have an off output, you should use another behavior, like proximity.

Oh I got this one [from JR01]:
image
Timer can be set to whatever u want, set it to 1 or 0 if you want instant. Replace the first half of the code in your screenshot with my screenshot. Wait, actually replace the timer with ur Collision, and a Raycast turns it off when it misses (Collision goes into the Switch’s On input).

If that doesn’t work, use Raycast instead of Collisions, but make the ray length really short so that it doesn’t stick out past the sprite. The Raycast’s Hit output goes into the Switch’s on input and its Miss output goes into the Switch’s off input. The Switch is off by default. Replace the timer with a Collision going into the In input of the Switch.

Click “Ctrl” “Shift” and the button that looks like a rectangle with 2 lines next to it above the number 6 to take a screenshot.

2 Likes