Hello, maybe this is a really noob question but since I'm a noob at programming, I guess this is normal.
Here is what I want to do:
I have a small ball in the center of screen and I want to control it with the mouse. The "follow mouse" function works perfectly.
But I want the ball to follow the mouse only in an specified area, this would be the black are of the screen (image attached).
I don't want the ball to go move over the walls.
So, to make the ball follow the mouse only in a specified region, I tried this:
I made a "Draw Actor" event in the ball and set "script editor" as the action.
In the script, I wrote:
- Code: Select all
if (-400 <= xmouse <= 200)
{
FollowMouse("Event Actor", X_AXIS);
}
if (xmouse > 200)
{
FollowMouse("Event Actor", NONE_AXIS);
}
So the ball would stop following the mouse on the X AXIS when the xmouse position were higher than 200 (which corresponds to the wall region).
But when I do this the ball simply doesn't move.
And if I use "else if" in place of the second "if", the ball starts following the mouse but won't stop even when xmouse is higher than 200.
So, any idea of what I'm doing wrong?