Adding behaviour at run time

0 favourites
  • 3 posts
From the Asset Store
Full game Construct 2 and Construct 3 to post on Google Play
  • Dear All,

    I am a beginner and just started to learn construct 3. currently i am making a break out game and i have created the basic game ie moving the paddle, destroying the object, moving to new layout(level) when all the bricks are destroyed.

    But then i decided to change the game a little. I am thinking to add a functionality that when some of my blocks gets destroyed, I want to recreate some blocks randomly to continue on playing for which i used System -> create object. but when the blocks are created, they just sit there and do nothing. ie not get destroyed when the ball hits it. so i am thinking that the behaviour are not applied to the newly created object. I have added physics to each block.

    so here is my question. Is there any way to create new instance of object with all the behaviour applied at runtime.

    Regards

    Devrishi Gupta

  • When you use "System-> Create", this creates an instance of your object, which inherits all behaviors, instance variables, effects etc. of the object. So if your block sprite has Physics behavior, all instances of this block will also have this behavior.

    When a new instance is created, all its properties are copied from the very first instance of this object which you placed on the layout in the editor. So if your first block instance has "Physics Initial State=Disabled", then all instances created in runtime will also have Physics behavior disabled, and you'll need to enable it with events.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thank you Sir for the explanation. That clear my doubt.

    Regards

    Devrishi

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