Anyway to spawn a <variable_name> Sprite? Family context

  • Hello there!

    Firstly, i actually know that i can "spawn another object" and pick the sprite i intend to spawn, while spawning the family itself, the sprite spawned will be random.

    My question is actually how to manage many sprites and it's spawns. Example:

    Suppose 80 enemies at 1 enemy family. The way im doing to have a function that receives a code (or "tag") respective to an enemy and then i check its value to know which sprite i should spawn. Like a switch/case.

    Theres anyway to spawn a <variable_name> sprite? Because with that, i could just pass the name by parameter and could even implement some randomness within choose() etc.

    Edit: found something related; basically C2 can't do this natively ()

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I think it's possible in C3, but not in C2.

    The best you can do is a bunch of events like this:

    If variable=x then spawn object x

    If variable=y then spawn object y

    etc.

  • Yeah dop, from what i read (after posting this thread, my bad) its native on C3. WIth C2 u need some third party or the way you stated (thats how im doing, but encapsulated in a function).

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