Platformer Enemy Behaviour

  • I just completed Ashley's beginner platformer tutorial and am trying to get my two enemies to behave independent of eachother but animations will get triggered simultaneously and if I kill one enemy the other will die too. I have been reading up on instance variables but have yet to find a solution. I don't have a coding background and the logic has me going in circles. Any help would be much appreciated.

  • I kinds wish there were FAQ of how to ask help....

    Firstly, it's nearly impossible to tell what's the problem on your code unless we can see it. So please, get (like) Dropbox account and upload the capx file there and post a link .... That way we can see the problem and explain the fix to you.

  • No need of Dropbox.

    The forum supports Attachments

  • Oh.. yes, you are right. Just need to use full editor instead of Quick Reply to see upload-button. That was something that was part of the new features of forum change.

  • the reason this happens is that c2 considers your 2 "enemy's" instances as one.

    many reasons for that.

    one solution would be to add " for each" -it is under the system commands" this way c2 will react to "each" lol.

    if you are using an invisible square sprite and on top of it your enemy's sprite then you must add both in a container.

    this way c2 will treat each instance as separate.

    if you could post a .capx i would be able to help you more specifically .

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • mustangflex use instance variables learn from this tutorial

    https://www.scirra.com/tutorials/806/instance-variable

  • Or maybe you're using system events, such as "Compare two values" and those don't pick objects. If you compare the enemy variable directly, it should work

  • Hey guys, thanks so much for the help. I was able to resolve the issue by giving each instance of my enemy and sprite a unique ID.

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