Inside/Outside of group

Get help using Construct 2

Post » Thu Dec 27, 2012 5:21 pm

Hey,

I got a little problem.

I tried to implement a life bar.

Everything works just fine, but if I put the whole events into a group, it stops working. The graphics animation does not change when the player leaves the layout. The rest of the code works, so after the 3rd time of leaving the layout, I get to the level selection screen.

Global variables at top:



rest of the code in a group:



How to fix this?Astrosus2013-01-01 01:53:09
B
8
S
2
Posts: 110
Reputation: 1,463

Post » Tue Jan 01, 2013 1:54 am

Does no one know how to fix this?
B
8
S
2
Posts: 110
Reputation: 1,463

Post » Tue Jan 01, 2013 3:48 pm

I have no idea why that's not working. Tried it myself and I get the same result. The manual doesn't really cover events in groups like it does families and containers.

Maybe the manual could get a more detailed description of what changes when events are in a group when @Ashley has the time?
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Post » Wed Jan 02, 2013 12:23 am

May be a bug with objects created/destroyed inside a loop within a group. Look at this:

I have 3 sprites.

The sprites are destroyed in event 2 and in event 3 Sprite.Count = 0.


Here the sprites are destroyed inside a loop and in event 3 Sprite.Count = 3. The sprites aren't destroyed until the end of the group.

destroyLoopGroup.capxramones2013-01-02 01:02:23
B
54
S
28
G
18
Posts: 1,520
Reputation: 25,020

Post » Wed Jan 02, 2013 12:36 am

It's not a bug, it's because created objects aren't selectable by other same level events until they are fully created, and they are not fully created until the next base level event. Since all of those events are in a group, the objects are not fully created until after the end of the group, therefore the events cannot pick the created objects.

To fix it, just put the first event above the group, or don't create them every tick and toggle visibility instead.Arima2013-01-02 00:39:46
Moderator
B
88
S
32
G
33
Posts: 3,005
Reputation: 27,432

Post » Wed Jan 02, 2013 1:16 am

[QUOTE=Arima]Since all of those events are in a group, the objects are not fully created until after the end of the group, therefore the events cannot pick the created objects.[/QUOTE]
@Arima r103.2 release notes:
[quote]
Separate triggers, and events in groups, are now treated as 'top level' when picking newly created objects.[/quote]
And it works but not when the object is created inside a loop. Then it can't be picked until the end of the group.

This works. The sprite can be picked and it's angle is set to 45.


And this doesn't. The angle isn't set. Only difference is the loop condition.
B
54
S
28
G
18
Posts: 1,520
Reputation: 25,020

Post » Wed Jan 02, 2013 1:46 am

Oh, interesting, I either missed or forgot about events in groups being considered top level events. Sorry for the incorrect info. I guess it is a bug, then.
Moderator
B
88
S
32
G
33
Posts: 3,005
Reputation: 27,432

Post » Wed Jan 02, 2013 2:24 pm

I created a topic in the bug report section. Thank you for your help!
B
8
S
2
Posts: 110
Reputation: 1,463

Post » Wed Jan 02, 2013 5:34 pm

Have you guys tried a "Pick all" system condition ?
For @Astrosus in the last event, on top of the "For each Hearts" and for @ramones event 4.

Does it change anything ?Kyatric2013-01-02 17:34:57
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


Return to How do I....?

Who is online

Users browsing this forum: armaldio, ETgirl79 and 21 guests