Container/Family/Multiple instances behaving independently

0 favourites
  • 7 posts
From the Asset Store
A collection of various zombie characters sprites for creating a 2D platformer or sidescroller game
  • Hi, I have attached a sample file. I would like someone to edit the file (fix it first).

    EnemyBox acts as the enemy.

    Enemy object's only purpose is animation, nothing else.

    If AI = 0 and every X Seconds, AI should go to either 1 or 2, to which it should walk right or left, respectively.

    AI is not resetting (I think).

    Please fix it and also I am requesting how multiple instances that behave independently but using same event/s. In this case, after fixing the "AI not resetting" issue, multiple instances of the Enemybox should already result in the instances walking left and right independently.

    I already used containers.

    Thank you.

    P.S.

    If you are using the newest versions of C2, please give me a screenshot of the events instead. I have problems downloading using direct download (torrent is working but super super slow download speed).

  • Did you want the enemy to "patrol" on the platform ?

    If yes, check this :

    [attachment=0:29fnel6n][/attachment:29fnel6n]

    Tell me for this then I ll check for your second request.

  • uhm, that file was based from the original file I was making (but the original file was too complex with many variables to show to anyone), so I made this simplified file. The logic of the AI I used in that simple file is the same from my original file.

    I found out just now that I made a mistake in this condition

    +counter>=40

    -> Set Counter to 0

    It should be like this:

    +counter>=40

    -> Set Counter to 0

    -> Set AI to 0

    The attached file is now fixed. While this file is simplified version of my original file, I learned an idea from you (using the condition "has a wall to the right/left"), so thank you.

    Based on the attached file in this post, I would like to ask questions:

    In my original file, I use families instead of objects.

    Objects:

    Enemy

    EnemyBox

    replaced by

    Families:

    Enemies

    EnemyBoxes

    but same conditions.

    Result: only 1 instance is actually moving according to the events. The other instances of EnemyBox is not moving, but the other Enemy objects are using the same animations as the only working Enemy object.

  • sgn, I think this is what you are looking for:

    Basically, if you want to change an aspect that is going to be different in each of the instances of the object, you should use "for each [object]" condition as seen in the picture. I couldn't understand what you want in the post, but I am sure this is going to lead to your answer.

    Hope it helps.

  • I want to do everything in the latest file I posted but using families instead of specific objects (in both conditions and actions). It seems it's really not possible to do that using families?

    I need to use families because I have several other enemy types and they all have the same AI rules.

    Basically, let's say I have 3 enemy types:

    soldier

    fighter

    gangster

    those 3 above are under the family ENEMIES

    each of those 3 have their corresponding collision box

    soldierBox

    fighterBox

    gangsterBox

    Now these 3 are also under another family ENEMYBOXES

    Now I use ENEMIES and ENEMYBOXES in my events. They don;t behave independently anymore. Is this how it really works in C2? Because I just tried in another blank file, the same exact events but using specific objects, they behave independently. So basically, I found out the problem already. C2 doesn't allow me to use families in events.

    I can make a workaround for this by making 3 sets of same events, 1 for each enemy type, just triple the work. But I thought the essence of families was for this issue? That's what I was wondering about. Please answer. Thank you.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Here is the proof of what I am saying

    this is the same file from my last uploaded file here

    changes:

    -replaced all objects (in all conditions and actions) into families

    -the behaviors and variables used are from the family, not the objects

    now test the file, the enemy (animation object) doesn't behave independently anymore (especially the mirrored or not mirrored action)

    Is this a bug with families? because I already read the manual on families and what I am trying to do should work with families (as far as I understood).

  • I had some trouble trying to figure out what you wanted to do.

    So i actually started from scratch. (you made a lot of stuff different from how i would do it)

    here is how i would do it with families:

    https://dl.dropboxusercontent.com/u/2560922/mobiledev/forum/families.capx

    The reason why your sample is not working is because of how you do "picking". But hey.. I still get confused about picking

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