How do I create a family that encompases compound objects.

0 favourites
  • 4 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • Okay folks... this might be an impossible question...

    I want to create a compound family object.

    Each character in my game has the following objects:

    1. CharacterSprite (the animation object)

    2. CharacterCollider (with physics behavior attached)

    3. CharacterState (checks for collisions up, down, left, and right. Also checks what direction the character is going relative to the direction of gravity. Using all of this the object sets flags for such things as "inAir" "Onground" and "OnLeftWall"

    4. CharacterCollect (an object used to test for collisions with collectables and powerups)

    5. CharacterHitBox (an object to test for collisions with objects that can damage it)

    I also have a few extra objects to manage the butload of variables and constants needed for functionality.

    All of these objects have to communicate with each other, but regardless of what the character is (fish, turtle, or bird), the character state will always do the same thing, but I need to know what its state is before I can tell it to fly. Setting this stuff up for every character in a game with dozens is tedious, repetitive and time consuming.

    I can also say that I could write this up in C# using OOP with no trouble but I can't figure out how to do it in construct without being able to derive objects from one another. any ideas?

    I thought about just creating a family for each type of object in the compound object and another family to rule over them, but then I am still left with creating a bunch of objects manually.

    Thanks,

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • So your different characters (fish, turtle, bird) are different object types, or different instances of CharacterSprite?

  • codah - they would be objects that inherit the behavior of the compound object

  • Gotcha, so having FishSprite which contains those objects in a container, and have it in a 'state' Family won't work for you? Perhaps you need to give us a diagram of how you 'picture' the object structure (whether or not it would be possible in C2).

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