Inherit actions?

0 favourites
  • 6 posts
From the Asset Store
Alot of High Quality Items sound effects for your game!
  • I'm looking for a way to apply the same set actions to any Sprite object type.

    More specifically, I have different types of Sprites to which I apply the same Physics actions (from the Physic behavior) to each object except with different angles. Now I know I can create a family but then I wouldn't be able to set different angles (would I?).

    So I thought maybe I could create a function in the Event sheet and set a custom condition that picks the Sprite and then have access to the Actions available to the picked instance without duplicating them in my plugin. This way I can call this function in the Event sheet for each of the Sprite types to apply the actions.

    Is it possible to inherit actions like that?

    Thanks.

  • MakubeX

    You could call sprite's (or other object) action function at other plugin/behavior.

    Reference - call "text: set text" at it's behavior.

    cr.plugins_.Text.prototype.acts.SetText.apply(this.inst, [s]);
  • Thanks Rex, I'll try that.

  • rexrainbow

    I tried calling the Physics behavior action ApplyImpulseAtAgnle from within one of the actions in my plugin but it throws and error when the function ApplyImpulseAtAgnle() tries to call the function getInstImgPointX().

    Error says: 'this.getInstImgPointX is not a function'

    So it looks like problem is 'this' is referencing my plugin. Is there a way around this?

    Thanks!

  • I have a gravity behavior which call set force at physical behavior.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • rexrainbow

    Funny, I was already looking at that after finding it in an older post.

    Edit: Ok, I see what you pointed out. I have to get an instance of the Physics behavior.

    Thanks for the info, I'll report back with my results.

    Edit 2: Everything worked perfectly. Thanks again!

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