behavior of the enemy

0 favourites
  • 8 posts
From the Asset Store
Give Sound to the enemies that are part of your game! :)
  • Hello there,

    this is my .capx file :


    i would like to know what is the best way to move the enemy and make them attack my player.

    Any advice ? i'm new in C2 and this is my first project, sorry.


    mr sponkie

  • anyone can help me?

  • I'd suggest you to check this topic which is pretty much the solution I'd recommend to you, making all the "hitboxes" invisible.

    Edit: Nice art by the way.

  • please kyatric,

    i need your help again :((

    i still don't understand why my enemy don't turn right when he collide with "tornaindietro" object.

    I think that all should works fine but it not works properly.


  • It has to do with the positioning of the origin point.

    I tried to move the origin point in "camminadestra" animations to position it on the shield in each frame, and the movement work as intended.

    If you don't want to change the origin point, instead of using two instances of "tornaindietro", make one object for the left boundary, one for the right (with different names) and on collision with either the first or the second object, set the boolean (don't just toggle it) to either "true" or "false".

    This way you'll have a defined direction, and it doesn't matter how many times the ennemy sprite collides with the "detector" it will set it to one and only one direction.

    I hope I'm being clear, let me know if not.

  • ok now it works thank you !!! :)))


  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Dear Kyatric,

    so maybe i didn't choose a simple game as my first project with C2, but anyway i want to go ahead and make what i've in mind.

    For now i made a simple player that can jump and destroy one enemy, the problem is when i add another enemy and i want to destroy him, bot enemies die. How can i fix this ?


  • It is so because at the moment you have a global variable acting as the "health counter".

    Once this health counter is null (0) you destroy all the instances "nemicosinistra" (not a peculiar one).

    To solve this, your health counter should be an instance variable of "nemicosinistra".

    When you test if the instance variable "health" of the object type "nemicosinistra" is equal to 0, then C2 will pick the instances which "health" variable is equal to 0.

    For this you can check back the beginner's tutorial which clearly demonstrate this principle in page 6.

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