Moving my enemy

I created my actor (enemy) and would like to put a move on him, I wish he walked, for example, from x = 100 to x = 300 and x = 300 to x = 100 in loop.

how can I do that?

Comments

  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273
    Your going to want to position our actor at X=100.

    Create a rule:
    When attribute self.Position.X = 100,
    Interpolate self.position.x to 300

    New rule
    When attribute self.position.x = 300,
    Interpolate self.position.x to 100

    Or,

    Create a real self attribute - call it start.x

    Constrain attribute self.position.x to sin(self.Time*100)*100+self.start.x

    You might need to tweak the "100" which is outside the parenthesis - this tells the actor how far to move.
  • doug_smuppetdoug_smuppet Member Posts: 99
    the first option it's worked for me, but the second I don't worked, but, the 2 options are the same function.. right? I'll use this for many actors, but in differents positions.

    *I have windows version.
  • SocksSocks London, UK.Member Posts: 12,822
    edited March 2013
    Constrain self position X to:

    AAA*sin(self.Time*BBB)+CCC

    AAA = how far you want your actor to move in each (left and right) direction.
    BBB = the speed of movement.
    CCC = the centre point of its movement.


    So for 100 to 300 it would be: 100*sin(self.Time*100)+200
  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273
    ..or what @Socks said. ;)
Sign In or Register to comment.