Object (enemy) Changing Direction On Collision And Move Automatically

Discussion in 'How Can I...?' started by denban, Nov 21, 2016.

  1. denban

    denban Boxer

    Joined:
    Nov 14, 2016
    Messages:
    13
    Likes Received:
    3
    Hi,

    maybe somebody can help me. I need an enemy which spawns every some seconds and moves automatically. Then it should change it direction, by collision a platform.

    So, I have an object and added Advanced Move with dollowing settings: Linear Velocity = 10, Mathematical Operation = Add, Event = On Start.

    So this works fine. My Enemy walks automatically.

    I have added second Advanced Move with following settings: Linear Velocity = -10, Mathematical Operation = Replace, Event = Collision, Affected Asset = All (I also tried other affected assets)

    The second Advanced Move does not work. Nothing happens. What am I doing wrong?

    Thanks
    Best Regards
     
  2. TheGameAppStudio

    TheGameAppStudio Serious Boxer

    Joined:
    Nov 2, 2016
    Messages:
    778
    Likes Received:
    237
  3. denban

    denban Boxer

    Joined:
    Nov 14, 2016
    Messages:
    13
    Likes Received:
    3
    I think, I have to add an animation in the advanced moves and also add collision shape to this animations. But if I do this and start my game, Buildbox crashes. So I cannot try this solution.
     
  4. AlexandreAbreu

    AlexandreAbreu Boxer

    Joined:
    Nov 22, 2016
    Messages:
    7
    Likes Received:
    0
    I have the same question. I have two objects moving towards each other and I want them to change direction on collision.

    My object has a Advanced Move with Linear Velocity: -8, Mathematical Expression: Replace (with add, it will accelerate the object) and Event: On Start.
    And another Advanced Move with Linear Velocity: -1, Mathematical Expression: Multiply, Event: On Collision, and affected asset: the object(I've tried everything).

    I've also noted that if the sub-object is set to fixed it will not move (advanced move) but if I set linear velocity on the sub-object it will move.

    I believe your problem can be done with a Logic Transform piece, you will have to place one on every platform though. Or, if it has a set path try using the Logic Path.
    NOTE: My problem could also be done with a logic transform or path piece, but with the advanced move it would be much easier and better. It doesn't make any sense to me why it does not work..


    I've tried your suggestion and it doesn't work.
     
  5. TheGameAppStudio

    TheGameAppStudio Serious Boxer

    Joined:
    Nov 2, 2016
    Messages:
    778
    Likes Received:
    237
    @denban @AlexandreAbreu I got it working.What i did was i add the animation on advance move and set scale to -1,1 and just clicked edit collision and didn't do any change and simply exit.Viola it worked.
     
  6. AlexandreAbreu

    AlexandreAbreu Boxer

    Joined:
    Nov 22, 2016
    Messages:
    7
    Likes Received:
    0

Share This Page