As my actor moves, have it go slightly up and down

daverennerdaverenner Member Posts: 133
edited November -1 in Working with GS (Mac)
i have actors that automatically move across the screen. How can i have it so they kinda move up and down sorta like a sine wave?

Comments

  • StusAppsStusApps Member, PRO Posts: 1,352
    Easy if they don't move up and down (this example will only work for characters that move in a straight left or right line) and this doesn't use any timers.

    when RIGHT = true (or whatever tells your character to move right).

    RULE - if self.positionY=120 (characters height on screen)

    interpolate self.positionY to 123 - Linear
    duration 0.1

    RULE - if self.positionY=123

    interpolate self.positionY to 120 - Linear
    duration 0.1

    Change the amount and duration for the effect you need..
  • daverennerdaverenner Member Posts: 133
    Man i love the GS forums! Everyone is so helpful. I will try that out Stu.
  • AfterBurnettAfterBurnett Member Posts: 3,474
    Or you could do it with "move" using angles under the same rules Stu has pointed out when y = 120, move diagonally down... when y = 100, move diagonally up.... Not sure which is heavier on the processor though...
  • StusAppsStusApps Member, PRO Posts: 1,352
    not sure how good my solution would be for a moving actor, should be fine going along a single Y line, but not for anything else. I only used it to make a fish look like it's bobbing up and down in the water, but the fish was still at that point.
  • AfterBurnettAfterBurnett Member Posts: 3,474
    Would the interpolate behaviour override the move rule?
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    there is a spot in the wiki on sin movement
Sign In or Register to comment.