Construct 2 Default Instances Possible Bug

0 favourites
  • 10 posts
From the Asset Store
Casino? money? who knows? but the target is the same!
  • The default values for an object's instance variables don't work as expected.

    Repro Steps

    Create a new project with two layouts, Layout 1 and Layout 2. Create a new object type called Block.

    1. Create first Sprite Block "Instance A" on top-level layout Layout 1

    2. Add new instance variable, "PropValue", set to 10 for Block.

    2. Create a second Block "Instance B" in Layout 2 (PropValue correctly initialized to 10 from "Instance A")

    3. Delete top-level instance "Instance A" from Layout 1.

    4. Set PropValue on Instance B to 20.

    5. Drag new instance of Block onto editor from Project Object Type List (into either Layout)

    6. New instance is incorrectly initialized with value 10 from previously deleted instance.

    Expected Behavior:

    New instance should have property values equivalent to only remaining instance since it is now the archetype template for Object Type Block.

    Workaround:

    Completely reload the project file in Construct 2. This will reset the "in-memory" prototype of Block and its associated instance variable's values.

    See 1 minute video demonstration:

    Not a huge deal, but if you're dealing with a lot of object types and lots of instance variables, you can easily make mistakes because of this.

  • I don't agree. The root instance is the one in the Project Object Type List, which is what I expect.

  • I always hated default instances. Instead there should just be the 'default object' stored in the object bar. Not only do you NEED an instance in a layout, but you can't change which instance is the default one that future instances inherit their properties from. This can cause issues down the road, especially if you forgot to create a default instance in an object-bank layout.

    Also the issue you brought up seems like a bug to me.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I don't agree. The root instance is the one in the Project Object Type List, which is what I expect.

    zenox98

    I think you might be misunderstanding the issue. The Project Object Type List is not an actual instance, it is just the Object Type. As an example, remove all the instances of an Object Type off all layouts. Now click on the Object under the Project Object Type List. Notice that it doesn't show any actual properties? (No position, no instance variables, etc)

  • Did you try right click copy, and then paste?

    That would give you a copy of that instance.

    There is a bug with that, in that its still not a perfect copy, not all behaviors, params set, etc.

  • it seems like this is still an issue. i am currently working in a game and this bug is a roadblock for me.

  • Workaround:

    Completely reload the project file in Construct 2. This will reset the "in-memory" prototype of Block and its associated instance variable's values.

    I hate what that 'workarround' implies. Because. Well, if you are not carefull, the copys that you make tomorrow will have their instance variables set to different values as the copys that you made today.

    Rather:

    create a default instance in an object-bank layout.

    Better:

    Hope it gets fixes one day.

  • I see what you are saying it is the one from last instance deleted that sets the default value instead of the very last instance deleted

    although I would much prefer that the original set value remained and only changes if you change the main object IV not inheriting any values from those in layout

    I cant really see how this would be in issue though.....interested to know why it is a blocker for kururugi66

    maybe it would be better to spawn instances at runtime from spawn objects or by system at co-ordinates. And then set the instance variables in game in a different way eg from an array.

  • NetOne it is like this:

    on layout 1, i made a sprite with instance variable with a value "testValue"

    on layout 2, i used the same sprite but without value

    then on layout 2 event sheet, i destroyed the sprite then recreate it again. the result is that the sprite i recreated on layout 2 style sheet still have the "testValue" value.

    this happened when i tried to duplicate the GUI of my game to another layout with different use

  • I always hated default instances. Instead there should just be the 'default object' stored in the object bar. Not only do you NEED an instance in a layout, but you can't change which instance is the default one that future instances inherit their properties from. This can cause issues down the road, especially if you forgot to create a default instance in an object-bank layout.

    True. I hope Scirra works on a solution for this in C3.

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