Family creates random sprite

Bugs will be moved here once resolved.

Post » Sat Mar 02, 2013 10:57 pm

Link to .capx file (required!):

Steps to reproduce:
1. Create a family with at least two different sprites.
2. Set a instance variable to family, and set a individual number to each sprite family member (1, 2 etc).
3. Use a For loop to go through family and as a sub event, compare a number against the family members instance variable, and when these numbers are correct (ex 1 == 1) create a sprite of that family member.
4. Restarting the game, or pressing F5 to refresh the window, will cause the created sprite to change randomly, eventhough they should stay the same.

Observed result:
The result is that the loop creates a sprite all right, but the family member it creates the sprite from is random, even though it should always be the same sprite, based on the given instance variable. The sprite that should be created should have the same instance variable as the sub event check.

This becomes clear when restarting the game or refreshing the page by hitting F5 several times.

Expected result:
The same sprite should be created at the same spot every time when restarting the game or refreshing the window by hitting F5.

Browsers affected:
Chrome: Haven't tested
Firefox: Haven't tested.
Internet Explorer: Haven't tested.
Opera: Yes.

Operating system & service pack:
Windows XP SP3
Construct 2 version: 120.2

Link to capx example:
Posts: 151
Reputation: 8,397

Post » Mon Mar 04, 2013 6:49 pm

Closing, this is by design. If you create an object and select a family, it picks a random object in the family at runtime, regardless of the events before it. To create a specific object, choose the specific object instead of the family.
Scirra Founder
Posts: 22,832
Reputation: 176,750

Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 4 guests