Need help making a enemy go from left to right on a ledge.

777ideas.com777ideas.com Member, PRO Posts: 895
edited November -1 in Working with GS (Mac)
Hi , I need help with making an enemy go right to left or left to right; I just need it to stay on a ledge and go back and forth on the ledge , that's it. I also checked the How's and the Faq's still no help.
Please help with be greatly appreciated.
Thanks

Comments

  • iDeveloperziDeveloperz Member Posts: 1,169
    Ohh p-o-m told me how to do this. I think... 1 min and ill get the link. :)

    Edit: http://gamesalad.com/forums/topic.php?id=7248
  • 777ideas.com777ideas.com Member, PRO Posts: 895
    No, I tried that I need help for an enemy to say on a ledge and go back and forth.
  • 2D-Sprite-Box2D-Sprite-Box Member Posts: 72
    I'd put in a left block and right block, add the rule when enemy collides with the block change the movement of the enemy, make the blocks either clear with alpha 0 or uncheck visible. If gravity is in the scene, uncheck moveable. Place the blocks on the edge of your ledge.
  • 777ideas.com777ideas.com Member, PRO Posts: 895
    Im new to game salad so can you please put it in steps please
  • 2D-Sprite-Box2D-Sprite-Box Member Posts: 72
    Sure, what I'd do is add an actor, go into the properties, change the size to something small, like 10x10, under color change the alpha to 0, under Physics, uncheck moveable. Make a copy of the actor, name one left and the other right. Place them on the edge of the ledge, left on the right side and right on the left side. Go to your enemy and add a rule-when actor collides with left, add change attribute for movement, change it for moving left. Add another rule for the right.
  • RattleheadRattlehead Member Posts: 485
    I have coupled what 2D-Sprite-Box said with iDeveloperz link and it works great.
  • SingleSparqSingleSparq Member Posts: 1,339
    Try this:

    To your enemy actor add "change velocity" - set the direction you want it to go - so if your character is at the left - set direction to right (0 would be right - 180 would point left) add a speed 40 (you can change this to your liking). Set relative to actor.

    Now add a timer - set for Every 10 seconds (again, to your liking - the speed and secs will determine how fast it moves and when it turns)

    In the timer add a "change attribute".
    From the first field (...) select your actor (self) and set it to "self.Motion.Linear Velocity.X".

    In the "to:" area do the same but place minus (-) before it (- self.Motion.Linear Velocity.X)

    Your guy should now go back and forth at a set pace

    EDIT - okay what iDeveloperz said!!
  • 777ideas.com777ideas.com Member, PRO Posts: 895
    I was up all night still not working for me could you please add screenshots or make a video on how to do it . I need a enemy to guard a object on a ledge and go left and right or tight to left it doesn't matter.
    olease help.
Sign In or Register to comment.