I want to make the same sprite be created as many times as there are values in "iteraktList". Let's say iteraktList is equal to two sprites. But the sprite is created only once and in the last sprite that was added
for (i in 0...iteraktList.length)
{
what = new FlxSprite(iteraktList[i].x + (iteraktList[i].width / 2) - 10, iteraktList[i].y - 30).loadGraphic(Paths.image('spooky/what'));
what.visible = false;
what.setGraphicSize(Std.int(what.width * 2));
add(what);
}
So i do this and thats dont work BUT i try to make 'what' sprite 'I' times like this:
for (i in 0...iteraktList.length)
{
what[i] = new FlxSprite(iteraktList[i].x + (iteraktList[i].width / 2) - 10, iteraktList[i].y - 30).loadGraphic(Paths.image('spooky/what'));
what[i].visible = false;
what[i].setGraphicSize(Std.int(what[i].width * 2));
add(what[i]);
}
And an error popped up
Array access is not allowed on flixel.FlxSprite
for (i in 0...iteraktList.length)
{
var what = new FlxSprite(...);
...
}