0 Favourites

Enemy moves with only physics

  • Hi everyone.

    This is my first post. I?ve been playing with construct for about only 2 afternoons, but I?ve really felt in love with it.

    I?m trying to make a platform game without any platform behaviour (why? because I love physics and I love to try making things I still don?t know how to make thme).

    I?m having a problem with enemys movements. Two issues:

    • I?m not sure how to make a non playable character moves constantly in horizontal. I?m trying to apply forces or speed, and works well, but it gets broken when it collides with a wall for example.
    • If an AI driven character collides with a wall, I apply a force depending on if it?s mirrored or not, I apply a system wait delay for mirroring it (if I don?t delay it wait, it doesn?t work :S). The result is not very good I think, because it can collide with the player too.

    Thanks for all your help, and sorry for my bad english.

    EDIT: Here is the capx, I was changing the var names to English to make them more learnable for you :). Of course, if you see there are thing that can be in a more reliable way, tell me please! I?m a totally noob on this <img src="smileys/smiley11.gif" border="0" align="middle"> jajaja. Thanks.

    NOTE: Graphics and everything is only for learning, nothing is like it seems there :).

  • It would help us, to help you, if you would post your CAPX

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • It would help us, to help you, if you would post your CAPX

    Thanks, there it is, up in the first post :)

  • ok....now, what exactly is the problem? The NPC should move at a steady beat and bounce of the wall? What should happen if it colides with the player?

    Like THIS?

  • The idea is that if the NPC hits the wall, it gets mirrored and turn into the opposite direction.

    If it collides with the player, the player bounds a bit in the opposite direction of the collission.

    That�s the first idea.

    A second option or thing I would like to learn is that if the NPC collisions with the wall, the NPC bounds, and if he collides with the player, both bound in opposite directions.

    But I think I�d be able to reach this one if I get the first one :).

  • Take a look at this CAPX

  • Oh man, that�s pretty simple.

    I haven�t analyzed it at all yet (I�m at work) but it looks too much simpler than what I had.

    It doesn�t work in the same way with a moveable wall with physics, but I think this happens because I have something to fix in the physics of that type of walls.

    Do the forces have to be low numbers? I was applying forces too (100 instead), and you gain what I want more or less with a 0.5 value.

    Thanks Wieshaupt!

  • since the force is apply every tick, it does not have to be big. Just play around with the numbers and see what happens....

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)