setting frame for specific sprite copy (instance?)

0 favourites
  • 5 posts
From the Asset Store
Selection frame like in RTS games, works both on mobile and desktop devices.
  • Hello,

    I my layout i created a sprite called "star" and then copy and pasted it a few times, creating a number of stars. This is copy-and-paste, not clone, so the name of the sprite is shared across all.

    I want to selectively change the frame for each pasted "instance" -- treating them essentially as distinct objects.

    Can this be done?

    thank you,

    Daniel

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Each pasted object will have each IID(Start with 0) and UID(Unique).

    You can control it by getting those ID.

    Check this for more details: construct.net/en

  • thank you.

    Its not clear to me how i could, for example, create a loop and identify each instance by IID and set, say, its frame, based on some on some predefined configuration.

  • In a loop, you can use 'loopindex' to define your sprite like set frame or change it variables to do something later.

    Ex: Set frame to loopindex

  • You can set animation frame for each instance in the layout editor (on the left panel). No code is required.

    If you need to change frames during runtime, you can identify each instance by IID/UID as Maverick1912 suggested. Or add some instance variable, for example "Type". Then you can use an event like

    System For each Sprite 
     Sprite.Type=1 -> set animation frame to 5
     Sprite.Type=2 -> set animation frame to 10
    
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)