Should behaviours be applied at family level or at sprite level?

0 favourites
  • 4 posts
From the Asset Store
A collection of various zombie characters sprites for creating a 2D platformer or sidescroller game
  • My player sprite which collides with other instances of the player sprite in different ways in a local multiplayer game. In order to get the desired results I created a PlayerFamily and defined all my player instance variables at the family level. However my behaviours (e.g. platform, bullet etc...) were originally defined at the player sprite level.

    Does defining behaviours at the family level make any difference to how Construct behaves when treating multiple instances of a sprite from the same family compared to defining the behaviour at the sprite level? Only the Player sprite exists in the PlayerFamily.

    Just want to avoid reworking things before I plough ahead.

    thanks

  • Not sure why you used family to begin with? Player is the only object in the family, you can use player collides with player.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It's a beat 'em up game with 4 players in which simultaneous attacks/throws against more than one other player are possible. Complex collision/overlap checks and lots of instance variables needed. When defining events I find it easier to separate between cause and effect when comparing Player to PlayerFamily than using other techniques to distinguish between two or more Player instances.

  • The instance variables you are using on the family could simply be used on the player object. For now you won't see a problem because you have one object in the family, making it redundant. Imagine you had 2 objects in the family, you would have to pick the objects separately when referring to their behaviour while the family would be used for instance variables, it doesn't make much sense and makes picking more difficult. Your question only really applies to when families are used properly and in that case the shared behaviours and variables should be used with the family, with a single object it doesn't really matter.

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