Kain Nobel
Member
Good day everybody!
After updating certain scripts, there's something in my personal Window Movable module that I've always wanted to do. Now, to move a window, I can use either of these commands, which do the same thing (then 'update' recalls the method continuously until the self.x == @new_x)
But then, I've created other methods like x_plus and x_minus, which is something like this
But, what if I wanted to enhance the @new_x (or @new_y or whatever) so that I could do the same thing via...
Is there a way I can do that? Basically, I need to modify a property's operator methods, like @new_x += ? and @new_y -= ? and stuff like that. In other words, I'm trying to get rid of the dependancy on the x_to(), y_to(), fade_opacity() type methods, since all they do is set instances (and share the same @delay instance for move speed), and just redefine their operators to mimic my example.
After updating certain scripts, there's something in my personal Window Movable module that I've always wanted to do. Now, to move a window, I can use either of these commands, which do the same thing (then 'update' recalls the method continuously until the self.x == @new_x)
Code:
@window.x_to(320)
@window.new_x = 320
But then, I've created other methods like x_plus and x_minus, which is something like this
Code:
def x_plus(n)
 @new_x = self.x + n
end
But, what if I wanted to enhance the @new_x (or @new_y or whatever) so that I could do the same thing via...
Code:
@window.new_x += 320 # Translates to @new_x = self.x + 320
Is there a way I can do that? Basically, I need to modify a property's operator methods, like @new_x += ? and @new_y -= ? and stuff like that. In other words, I'm trying to get rid of the dependancy on the x_to(), y_to(), fade_opacity() type methods, since all they do is set instances (and share the same @delay instance for move speed), and just redefine their operators to mimic my example.