Moving an actor repeatedly between two points
mrcrookz
Member Posts: 9
I'm a little stuck what I'm trying to do is the get an enemy actor to go up and down repeatedly on a certain point of the scene. Can someone help me out please? and thank you
Comments
Another way to do it is with timers - "every 2 seconds, move (or interpolate) to position X; after 1 second, every 2 seconds move to position Y".
I'm sure some of the other devs around here can suggest other methods. :-)
Hey there
Next time try to make the title more informative ..
Sure you can use the examples above to achieve the goal you want.
Another way to do this ( my favorite ) is to put a simple constrain rule:
Constrain self position y to sin(self.time*speed)*pixels to move + middle
Speed- any number- the higher you put the faster.
Pixels to move - any number- your actor will move this number of pixels up from "middle" and the same number of pixels down from "middle"
Middle: the initial Y position of your actor when it starts moving up and down (don't use self.position, put an actual number)
Hope it helps.
Roy.
thank you roy i will try this method as well see how it works
distance = 500
constrain self.position.y = sin(game.time*speed)*distance
see my trig101 demo under my profile
edit: oops i didn't see someone had already posted this before me