Sprite object is not destroyed properly

Bugs will be moved here once resolved.

Post » Mon Sep 29, 2014 8:32 am

Problem Description
Destroying last object in the StartOfLayout event (also tried keyboard events, same) will not destroy the object properly.

Attach a Capx
Bug.capx


Description of Capx
Destroys last instance of object type "A" and creates new one. After that tries to move only instance of type "B" next to type "A".

Steps to Reproduce Bug
  • Run the capx, and you will see it is working as expected.
  • After that, disable the "Wait 0 second" action and run it again.

Observed Result
B will be moved next to first instance of A (which supposed to be destroyed).
(first instance of A is not visible anymore)

Expected Result
First instance of A must be destroyed, and B must be move next to newly created instance of A without using "Wait 0 second" action.

Affected Browsers
  • Chrome: (YES)
  • FireFox: (YES)
  • Internet Explorer: (YES)
  • Node-Webkit: (YES)

Operating System and Service Pack
Windows 8.1 x64 with latets updates.

Construct 2 Version ID
Construct 2 182 Beta
You do not have the required permissions to view the files attached to this post.
B
11
S
2
G
1
Posts: 25
Reputation: 1,685

Post » Mon Sep 29, 2014 2:57 pm

Closing as won't fix. Firstly 'Destroy' doesn't immediately destroy the object; it is flagged to be removed at the end of the next top-level event, so will continue to exist available for picking in subevents. Secondly 'Create object' does not really fully create the object until the end of the next top-level event, and it cannot be re-picked using "pick all" in sub-events until the end of the next top-level event. 'Create object' does however pick the object that is created, so if you set B's position immediately after the create action and just delete the sub-event it works.

The fact objects don't really create or destroy until the end of the next top-level event is an architectural limitation and it could not be worked around without great difficulty.
Scirra Founder
B
395
S
232
G
88
Posts: 24,371
Reputation: 193,762

Post » Mon Sep 29, 2014 3:26 pm

Ashley wrote:Firstly 'Destroy' doesn't immediately destroy the object; it is flagged to be removed at the end of the next top-level event, so will continue to exist available for picking in subevents. Secondly 'Create object' does not really fully create the object until the end of the next top-level event, and it cannot be re-picked using "pick all" in sub-events until the end of the next top-level event. 'Create object' does however pick the object that is created, so if you set B's position immediately after the create action and just delete the sub-event it works.

The fact objects don't really create or destroy until the end of the next top-level event is an architectural limitation and it could not be worked around without great difficulty.

@Ashley , I'm an avid manual user, I think I never came across this explanation and this is actually the first time I understand it properly. I would like to request this statement to be included into the manual under "How Events Work".
B
28
S
8
G
4
Posts: 553
Reputation: 4,924

Post » Tue Sep 30, 2014 6:33 am

Yes, it would be great. Because sometimes C2's event system puzzles me.
B
11
S
2
G
1
Posts: 25
Reputation: 1,685

Post » Mon Oct 06, 2014 5:47 pm

@DuckfaceNinja

good poinht becuase many times i have spent scratching my head when i ghet stuck with something and now it turns out it was becuase of this... this should be in the manual
B
23
S
6
G
3
Posts: 316
Reputation: 3,461

Post » Mon Oct 06, 2014 6:15 pm

How things work are usually intuitive for a coder to understand, but when it comes to non-coder like me, there are a lot of things that are non-intuitive, I rely heavily on the manual whenever my events doesn't work. The manual is a great tool during debugging in which you can counter-check the description whether your events is actually compliance to how things work. I'm sure there are more "manual material" that went unrecorded because it lays on the abyss of the forum, it needs somebody to point it out.
B
28
S
8
G
4
Posts: 553
Reputation: 4,924


Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 1 guest