Family creates random sprite

0 favourites
  • 2 posts
From the Asset Store
A collection of various zombie characters sprites for creating a 2D platformer or sidescroller game
  • Link to .capx file (required!):

    http://

    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:

    http://dl.dropbox.com/u/52716812/Projects/Issue/SpawnFamilyIssue.capx

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

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