Common Action Destroy - Destroys All Instances At Once

0 favourites
  • 6 posts
From the Asset Store
Change the size and position of everything without calculating anything!
  • Problem Description

    When not using a System For Each Loop to iterate over the Instances of an Object Type, the Common Action Destroy will destroy all of the Object Type's Instances in the SOL of an Event. This is in contrast to the notion that one Instance of the Object Type should be destroyed at a time when the Action List of the Event runs against each Instance of the Object Type. Because this is not the case, Actions that perform before the Common Action Destroy in the Action List are only performed for the first Object Type Instance in the SOL before all of the Instances get destroyed.

    In contrast, if a System For Each Loop is used instead, the Common Action Destroy in the Sub-Event will only destroy the currently picked Instance of the Object Type in the loop. This allows for the Actions performed before the Common Destroy Action in the Action List to occur for every Instance of the Object Type not just the first Object Type Instance in the SOL.

    Attach a Capx

    ____ Upload a Capx to this post ____

    Description of Capx

    Should append the Text Property values of all Instances of Text Object Type to the Text Property of the one Instance of the Text2 Object Type upon

    clicking one of the two Button Object Type Instances.

    Steps to Reproduce Bug

    • 1)Click on Button with the Text : 'Save Deleted Text Doesn't Work'
    • 2)Refresh Browser
    • 3)Click on Button with the Text: 'Save Deleted Text Does Work'

    Observed Result

    Performing Step 1) only appends:

    Text 1

    Performing Step 3) after Step 2) appends:

    Text1

    Text2

    Text3

    Expected Result

    Both Step 1) or Step 3) should result in the following text appended:

    Text1

    Text2

    Text3

    Affected Browsers

    • Chrome: YES
    • FireFox: YES
    • Internet Explorer: YES

    Operating System and Service Pack

    Windows 8 Pro 64-bit(6.2, Build 9200)

    Construct 2 Version ID

    Release 168(64-bit)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • This is absolutely normal. Because, without for-each statement you cannot access "Text" object's instances one by one. When you do that -> Text2.Append(Text.Text & newline), C2 will pickup the first instance of the "Text" object (will not itarate through the all instances automagically because you didn't say that to C2) and when you do that -> Text.Destroy(), you say to C2, please destroy all "Text" object's instances (Because, C2 will pickup all "Text" object instances automatically).

  • Hmm... I was probably misinterpreting the Manual's specification of 'Destroy': Remove the object from the game. I thought that meant the Instance that the Action List of the Event is running against. However, it must refer to the Instances of that Object Type in the Selected Object List. I think it would be good if the Manual was amended to have a more clear and non-ambiguous specification of the 'Destroy' Action. Thanks for your help !

  • Hmm... I was probably misinterpreting the Manual's specification of 'Destroy': Remove the object from the game. I thought that meant the Instance that the Action List of the Event is running against. However, it must refer to the Instances of that Object Type in the Selected Object List. I think it would be good if the Manual was amended to have a more clear and non-ambiguous specification of the 'Destroy' Action. Thanks for your help !

    Welcome, i am happy to help you.

  • Because, without for-each statement you cannot access "Text" object's instances one by one. .

    you can use numerous references to pick out any one instance, you can use self determined variables or refer to UIDs.

    event

    Pick by evaluating textobject.UID = YourDesiredID

    action

    destroy textobject

  • Closing, the .capx is working correctly. Your "expected result" is what's wrong!

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