Sub-Events not keeping parent instances

Bugs will be moved here once resolved.

Post » Fri Apr 19, 2013 1:40 am

Link to .capx file (required!):
https://www.dropbox.com/s/9mnvmk80836ltjl/subEventError.capx

Steps to reproduce:
1. Create an object with a instance variable (buggy)
2. Create an object that is destroyed quickly (destroyme)
3. Create an event with the buggy object (is visible)
4. Create a sub-event that causes the instance of buggy to spawn a new item (destroyme), and tells buggy to not spawn another with instance var.
5. Create a second sub-event on the destroy of the (destroyme) spawned item. (have it reset the instance var)
6. Place multiple instances of the main object (buggy)

Observed result:
buggy will spawn the destroyme object when it should not.
It appears the destruction from instance #1 caused instance #2 to reset also.
Expected result:
buggy will spawn the destroyme object wait for it to be destroyed then spawn a new one.

Browsers affected:
Chrome: yes
Firefox: ?
Internet Explorer: ?

Operating system & service pack:
Windows 8
Construct 2 version:
r126    
B
3
Posts: 2
Reputation: 204

Post » Fri Apr 19, 2013 2:25 am

[QUOTE=blefevre]It appears the destruction from instance #1 caused instance #2 to reset also.[/quote]

Due to the way you've set your events and how events work, you're not doing any picking on event 3. So all the instances of "buggy" will be affected and have their variable "bombOut" set to false when any destroyMe object gets destroyed.

You might want to keep a reference to the "buggy" instance that dropped the "destroyMe". (For example keep the UID of the "buggy" object as an instance variable of the "destroyMe" object)

Your capx fixed.
Is it the behavior you expect ?Kyatric2013-04-19 02:27:03
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,999
Reputation: 57,793

Post » Fri Apr 19, 2013 7:04 am

I just realized the same thing. The first selector for my event never filtered out the other objects so my instance variable update affected all the of them.

So yes, your code does fix the problem.

--Thanks
B
3
Posts: 2
Reputation: 204

Post » Fri Apr 19, 2013 12:36 pm

Closing as not a bug.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580


Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 3 guests