I have a script that moves a ball around the X and Y axises using the Left Analog. I am trying to restrict it within a 10x10 box (play area) however it looks as though the IF/ELSE filters aren't affecting it because the ball passes through the barriers no problem. The filters are linked to the same Impulse that triggers the Object Position Event. I have also tried delaying the pulse into the OPE to fire after the position check.
Left Stick Horizontal + Position X = Variable
IF Variable Greater than 840
TRUE: Set Variable to 840
Variable = Object new position x
Couldn't you just use some custom collisions/invisible walls to block the ball in?
you probably didn't trigger the generic filter
I tried the wall but the OPE pushes it right through. * The ball doesn't roll, it slides. Like the top-down arcade shooter, I don't want it to disappear off the sides of the play area.
The Generic Filter is linked to the Impulse that triggers the OPE through a splitter.
Impulse - Splitter - OPE, 4 Generic Filters (each outer wall). The Delayed Impulse was added after so that's not it.
I agree that it appears that the Filters aren't even activated, but I can't understand why. Here is the layout:
Stick value divided by 20 to slow it down.
Add 255.46 (current object position)
Set to Variable
If Variable is Less or Equals to border (250)
Set Variable to 250
Move object to x=Variable
* The off-camera side is the same.
When I run the map the Filters do not change colors (red/green), they always stay yellow.
![]()
You need Interval Triggers on the Generic Filters. They don't work without em.
As for keeping the ball inside the area, I think if you have 4 separate Generic Filters set do disable the left/right/up/down when the x/y reaches the walls, that should keep you inside.
Generic Filter true event and false event should be attached to a state event to toggle the up/down/left/right movements off and on.
I hope that works as well as I think it will![]()
There's one that runs all 4, maybe they each need a separate one? But that can't be since my other map has 6 filters running off 1.
I can't disable the 4 directions because I am using the -3/+3 of the Stick movement. Moves left/down with negative and right/up with positive. I'm using this input method so I don't have to load the map with state changes and 8 separate directions for each stick :/. That would mean 16 directions with 2 state changes eachso there's gotta be a simpler way..
if you enable physics on the ball you can use collisions as the border. just set it to decrease by the same amount as your movement increase on a hit triggers active setting. or use a set value event to change the type of the set value event thats moving the ball. increase is value 1 and decrease is value 2. this way will make the ball bounce at the edges.
or you can disable the set value event that moves the object on active, decrease slightly and activate it when the trigger is inactive.
i set invisible objects as the "corners" of the object so you can have a different response to collisions on different sides. you can also have a hit trigger for each "border" that works exactly the same. but you cant bounce off at the correct angle.
you can bounce off the wall, just stop, slide along it whatever you want.
its not complicated. good luck XD
What you could do is spawn 2 filters for each -3/+3. The first checks if the value is positive, the second checks if it's negative. From there you could have two more filters to check the global coordinates of the ball so you can only move that direction of you're within the 10x10 space OR trying to move back towards it.Originally Posted by Jolan
i don't really see the point of that delay impulse
the setup looks legit, although looking good and being good is still different
test it and look for any crossed signals
edit: the set values might work but maybe the value gets overwritten again before the position changes
a way to solve this might be to also put a set value between the add and the variable data scource for position
this can be trigered by the false values or maybe the impulse splitter u used before wathever works
john candy once said "sure ive got a small *****, but ive got 300 pounds to push it in with"![]()