createobject in loop

0 favourites
  • 13 posts
From the Asset Store
SynthWave Loop Pack includes 68 seamless loops, founded on 11 original melodies.
  • im running a for loop to create a bunch of icons, i have a container as start object, nowin first loop object copies the container object, second time in loop it copies the newly created object instead of the original container, so all icons created are the same, not the effect i desire, is there some way you can create object based on name($i_icon) or similar so that new objects are unique?

  • It depends on your project, so can you write your question in more detail?

  • Best way to get help:

    1. Tell us what the expected result is

    2. Tell us what is actually happening

    3. Post .capx or image of events (you can use the attach button when posting)

  • heres a image of the said code:

    the create object creates objects but not any new instances just copies of previous instance.

    i=0; num_games=5;

  • Only error I can spot is that the For loop already adds 1 every time, so you don't need that "Add 1 to i"

    "i" is just the name of the loop, not a variable

  • kaiko, i think you can use array for this problem. you for loop seems to right but it is taking the default value. Right. use array, say you are having 20 icon, make an array list and call one by one. simple !!!!!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • sorry but i am using an array, the problem is that createobject doesnt create a unique object, so when i load image from url, all game_icons get this image., since im creating a menu with different icon for each game ,now i get same icon for all games.not exactly what i want

  • That's the way "load image from url" works. It will update the image for all sprites. You'd have to load the image into a different frame.

  • there must be a work around, how can you display 40 different images fetched dynamically without creating 40 objects on stage?

  • there must be a work around, how can you display 40 different images fetched dynamically without creating 40 objects on stage?

    There are no work around, you can create 40 objects or you can add 40 frames to your object and then make a functionality that load them into the correct frames. Regardless of which way you do it, none of them are going to be pretty.

  • is this still the case?, no change in construct 2 for almost a year? i find it hard to believe that no one else has encountered this issue,

    not even a third party plugin that can deal with this problem?

  • I d'ont see an issue. Must be the beholders eye.

  • kaiko

    You could perhaps use canvas or paster, they both have a unique image per instance. There may be other plugins that do it, but I don't use many.

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