zig zag motion

bhaktarajbhaktaraj Member, PRO Posts: 29
Hi all,
I have a missile I and want that to travel in zig zag motion. please help

Comments

  • WingmanappsWingmanapps Member Posts: 458
    edited May 2013
    On your missile actor
    put in a timer
    every 4 sec
    change self.rotation to 45

    create new rule
    If self.rotation is = 45
    Put in a timer
    after 2 sec
    Change attribute self.rotation to -45

    But there are many ways to do it.
  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803
    Reduced code:

    Change self.rotation to 45 (unless it already starts at 45.
    Timer: Every 2 seconds change self.rotation to -self.rotation
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,879
    Perhaps a more organic, 'fishy swimmy' type of zig-sag movement is wanted:

    Constrain Attribute: self.rotation To: (angleToTarget)+(30*cos(self.Time *500))
  • WingmanappsWingmanapps Member Posts: 458
    @rthurman you sexy beast - you always have such refined solutions. Love it =D>
  • SolarPepperStudiosSolarPepperStudios Member Posts: 754
    @Wingmanapps =)) Wow, didn't expect that!
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,879
    I am afraid @Socks gets all the sexy credit. I stole the formula from his signature.

    (I guess I'm nothing but a cheap and tawdry imitation. Still -- it's nice to stand offstage and see how the rock stars of GameSalad work their magic.)
  • SolarPepperStudiosSolarPepperStudios Member Posts: 754
    @RTurman @Socks is indeed a master of GameSalad. I've used that same formula many a time in my games.
  • bhaktarajbhaktaraj Member, PRO Posts: 29
    Hi all. You guys were really really awesome . thanks for the great help. am very lucky to be in this forum love u all :)
  • djdeedjdee Member Posts: 180
    edited September 2014

    @RThurman said:
    Perhaps a more organic, 'fishy swimmy' type of zig-sag movement is wanted:

    Constrain Attribute: self.rotation To: (angleToTarget)+(30*cos(self.Time *500))

    hi @RThurman‌, i was wondering what you meant by "angleToTarget", did u mean "vector to angle"? My missile is moving from right to left of the screen. am using the move rule and the above constrain attribute that u suggested, but still going nowhere with it. Can u show me where am going wrong with it. Thank You

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,879

    @djdee‌ -- wow! blast from the past!

    Yes, 'angleToTarget' would be an attribute that contains the angle from the hero to the target. It could be calculated by using 'vectorToAngle' or perhaps some other way.

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,879

    @djdee‌ -- here is a quick example

  • djdeedjdee Member Posts: 180

    thanks a lot @RThurman‌ :)

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,879

    @djdee‌ -- you are welcome!

  • jay2dxjay2dx Member Posts: 611

    And ensure your direction of movement is set to actor not scene! maybe!

Sign In or Register to comment.