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
There's a couple ways you can do that. One is to use the interpolate or move behavior with a rule that says "when actor's position = #, move or interpolate to #2", and another rule that says "when actor's position = #2, move to #".
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. :-)
@mrc 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)
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