作成したオブジェクトに属性を追加しようとしています。ここでは鳥の表示オブジェクトを作成しましたが、これらの鳥にtypeOfBirdのような特定の属性を追加してから、bird.typeOfBirdのような属性に到達したいと思います。どうやってやるの?
module(...,package.seeall)
function new(params)
local bird=display.newImage(params.img,params.x,params.y)
function bird:touch(event)
local t = event.target
local phase = event.phase
if "began" == phase then
-- Make target the top-most object
local parent = t.parent
parent:insert( t )
display.getCurrentStage():setFocus( t )
t.isFocus = true
elseif t.isFocus then
if "moved" == phase then
t.x = event.x
t.y = event.y
elseif "ended" == phase or "cancelled" == phase then
display.getCurrentStage():setFocus( nil )
t.isFocus = false
end
end
return true
end