Following on from a query I had in another post Iam having to ask for help/suggestions once again.
I have a grid of objects (think space invader layout), I have a different image on each row.
I need to swap these images for sprites.
Sprites because I wouldnt have to alter my movement code then.
Iam familar with sprite sheets and use an external module for all sequences etc which I call into the main.lua.
Below is my stripped down code for the image call and for loops etc.
Any help would be most welacome, I have tried a number of things all to no avail.
[lua]-- enemys.lua –
function enemys:init(xloc, yloc, row )
self.image = display.newImage(“images/enemy”…row…".png" )
self.image:setReferencePoint( CenterReferencePoint )
self.image.x = xloc
self.image.y = yloc
self.image.name = “enemy”
end [/lua]
[lua] – main.lua –
local enemys = require(“modules.enemy”)
for j = 1, 5 do
for i = 1, 11 do
allEnemys[#allEnemys + 1] = enemys:new()
allEnemys[#allEnemys]:init(i * 60, j* 70 +70,j )
allEnemys[#allEnemys]:start()
end
end[/lua]
this is how I import my sprite data
[lua]display.newSprite(sprites.sheets.object,sprites.sequences.object)[/lua]
I was hoping it would be a simple method altering “images/enemy”…row…“png”
thank you