How to make a zig zag movement

jerlant360jerlant360 Member Posts: 82
edited August 2012 in Working with GS (Mac)
Guys how can i put a zig zag movement on one of my enemies falling from the top of the screen ??

Thanks!!

Comments

  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772
    Just FYI, double posting is not smiled upon. :)

    Wish I could offer some advice, I'm sure someone will, given time.

    Jamie
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited August 2012

    @jerlant360

    Hi, I think this is one problem that has more than one solution....here's one way I can think of:

    In your enemy actor you want to zigzag, put:

    Change Velocity Direction 225 Speed what suits you

    Interpolate self.Position.X to 250 ----- this figure is an example of course and is based on a distance of moving 78 pixels to the left from a starting point of 328; adjust accordingly as you want

    Timer For 10 seconds --- or as long or short as you want; or not even use a duration timer at all, just have your zigzag enemy automatically destroyed outside of the screen when it has left the bottom of the screen
    ---the following Timer nested in above ---
    Every 1 second ---- or whatever you want
    Rule When self.Position.X < 350 --- a number quite a way from the minimum (250 in this case); too close and it plays up...
    Interpolate self.Position.X to 406
    Otherwise
    Interpolate self.Position.X to 250

    This does work as I did a test; you'll need to adjust values to your needs throughout though (the values I used are based on iPad portrait for instance).

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • jerlant360jerlant360 Member Posts: 82
    edited August 2012
    Thanks gyroscope for taking your time to help me , it works very good Thanks a lot man!!! :D
Sign In or Register to comment.