Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Table containing bitmaps — Gideros Forum

Table containing bitmaps

sLKzsLKz Member
edited September 2014 in Bugs and issues
Hi!
I'm trying to make a table containing bitmaps and then set the position of the bitmaps.
But I'm getting the error:
main.lua:8: bad argument #1 to 'setPosition' (Sprite expected, got number)
stack traceback:
main.lua:8: in function 'init'
[string "property.lua"]:52: in function '__new'
[string "property.lua"]:59: in function 'new'
main.lua:17: in main chunk

This is the code:
scene = Core.class(Sprite)

function scene:init()
local blueCube = Bitmap.new(Texture.new("images/blueCube.png", true))

stackOne = {[1] = blueCube, [2] = blueCube, [3] = blueCube}

stackOne[1].setPosition(100, 100)
stackOne[2].setPosition(100, stackOne[1].getHeight() + 100)
stackOne[3].setPosition(100, stackOne[2].getHeight() + 100)

for key in stackOne do
self: addChild(key)
end
end

sc = scene.new()

stage: addChild(sc)

Comments

Sign In or Register to comment.