Behavior inheritance?

0 favourites
  • 3 posts
  • This question is aimed at plugin / behavior developers.

    Is it possible to have an object Action such as "Inherit from object" which takes the internal values/properties of a specific behavior of the chosen object and add/update these to the original object the Action is based on? (basically a way to inherit)

    The idea is for an item system. E.g. have a base "generic" type then create a "weapon" type and inherit the original values/features from the generic type.

    Haven't spent much time thinking about this so I could be missing something alot simpler, just wanted some feedback and advice! (and maybe some specific functions for the runtime)

    Thanks for your time,

    Rez

    P.S. I've been working on an inventory behavior which turns any object into a "container" and will use the web storage to save the container. Combining the above item behavior and this container behavior should provide a very robust item system. Well that's the plan!

    Lastly, to all the Scirra team thanks for producing such an amazing piece of software!! <img src="smileys/smiley32.gif" border="0" align="middle" />

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Have you tried Construct Classic and its 'families' system? That allows you to create a family like 'weapons', add three different kinds of 'weapon' sprite to the family, then make your events around the 'weapon' family (which appears like another object). Then, the events apply to all those objects.

  • Thanks for the reply Ashley. I've worked with families in Construct which would work. The idea is based on this article:

    Generic item system

    The item system works like a tree and starts from a few generic item types. My idea is to have an "item" behavior which is attached to a Sprite then you can create/add "features" e.g. "light" (item produces light) which are controlled by "conditions".

    The conditions determine the effect e.g. the "onoff" condition when true turns the light on, etc. The dynamic properties are set using object variables such as radius, etc. The conditions can be checked through an event in C2 to see if it is true or false.

    To me it would make programming complex items and effects using the C2 event sheet a lot easier although I might be wrong. The only problem I'm having is I can't copy the features and conditions to a new object. I have a generic light set up and I want to create a "Sunrod" (an exceptionally strong light) like the article but I don't want to redo all the events in C2 rather just have an action "Inherit" which takes all the information stored in the generic light.

    I could just program this myself in the runtime but I was wondering if there's a way to access another objects specific behavior data within another behavior runtime?

    Hmm, this is quite difficult to explain I'll do a bit more work and see if I can upload an example :/

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