Chaos Project

RPG Maker => RPG Maker Scripts => Script Troubleshooting => Topic started by: Zexion on October 10, 2012, 09:36:41 pm

Title: Moving a "window"/picture
Post by: Zexion on October 10, 2012, 09:36:41 pm
I need help making a picture move in a scene to a certain point, and then back to it's starting point and loop.

I know how to do the loop, and I know how to move the picture (horizontally)

@mnani.ox += 1

But how would i make it move from x = -40  to around x = 10, then back down to x = -40 and repeat endlessly?

Title: Re: Moving a "window"/picture
Post by: diagostimo on October 10, 2012, 11:21:09 pm
i made an example of such here of generating a circular pattern: http://forum.chaos-project.com/index.php/topic,12208.0/topicseen.html
all you would have to do is put that in a update method and check it against the x/y value and move acordingly, if your just wanting to go back and forth repetively, you could use a true/false variable to track its current direction, example:

if left_to_right = true
  @x += 1
else
  @x-= 1
end