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.
I COULD probably use raycasts to do it but Iâm still curious if thereâs I way to do the collisions thing.
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)
Since âCollisionâ doesnât have an off output, you should use another behavior, like proximity.
Oh I got this one [from JR01]:
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.