Spawn Instance by Name?!?

0 favourites
  • 6 posts
  • I am trying to build a "Spawner-Sprite" that is more or less generic and uses an Array to pick the "Name" of another object (ie. Sprite) and the "Probability" to spawn.

    The Spawn "new Object" does not allow to give the "Instance Name" on the fly - you have to pick it during programing. Is there another way to use the "Spawn new Object"?

  • maybe its not what your looking for but what if you used a multiframed sprite and calculate the probability on the amount of frames and then set the frame of that spawned image, this is how i deal with multi identity's, then you only need do deal with one sprite and compare the frame to know what is what

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • That wont help, since I realy want to spawn different "objects"...

  • well if you have different "objectsnames" as a string in you array, you can trigger it for example every x seconds , pick array value at x

    if that equels a certain "object1"

    create sprite1

    if that equels a certain "object2"

    create sprite2

    i dont think you can have a string directly spawn a sprite

  • that's a usefull work-around. Thanks for the hint. I will use a case structur...

  • I am struggling with this same problem. I need to spawn a sprite based on a value(string) that I have stored in an array.

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