C# xna to corona???

Hey! I need some help with some coding! basically for loops, my goal is to create random, but multiple images from one image, but each drawn image has its own conditions to it. like, can attack = false.
kinda like this c# example

public void multiEnemys()  
 {  
  
 levelDat = new levelData[1000];// set levelDat[] to 1000  
  
 for (i = 0; i \> 1000; i++) // for loop  
 {  
 levelDat[i].canBuild = true;// boolean  
  
  
 }  
public void Draw(SpriteBatch spriteBatch){  
  
foreach (levelData level in levelDat) // for each image in levelDat \*1000\*  
 {  
  
 spriteBatch.Draw(tree,level.pos, null, Color.White, 0, new Vector2(36, 96), level.scale, SpriteEffects.None, 0); // draw  
  
 }  
  
 }   

any help would be appreciated to the fullest!
Thanks

[import]uid: 56659 topic_id: 11376 reply_id: 311376[/import]

Here is the translation of your code to Lua

[lua]local levelDat={}

local function multiEnemies()
local i
for i=1,1000 do
levelDat[i]={canBuild=true}
end
end

local function Draw(spriteBatch)
local i,v
for i,v in pairs(levelDat)
spriteBatch.Draw(tree,level.pos,nil,color.white,{width=36,height=96}, level.scale, spriteEffects.None,0)
end
end[/lua]

However you will have to create all the classes for level, color, spriteEffects, spriteBatch, etc.

If you are after a class that allows you to perform animation, look at the SpriteSheet documentation. If it is anything else, please be a bit more specific on what are you after?

cheers,

?:slight_smile: [import]uid: 3826 topic_id: 11376 reply_id: 41252[/import]

Help with for loops?

http://tinyurl.com/q74bat [import]uid: 58455 topic_id: 11376 reply_id: 41283[/import]