Hi,
I’ve been trying for some hours now do the following:
change an object’s sprite using a tileset.
specifically, I’m trying to do the following:
-
in Tiled, I’ve created an Object “food”, which has no image whatsoever attached to it
-
in Lua, I’ve used a property listener to get the value of the sprite “food”, which has in the tileset viewer a property called “IsFood”
[lua]local foodObjSpr = function(property, type, object)
foodSprite = object.sprite
end
self.map:addPropertyListener(“IsFood”, foodObjSpr) [/lua]
- so the global foodSprite obj would be available to change the objects image representation as
[lua]local onFood = function(object)
print(foodSprite.value)
food = display.newImage(foodSprite)
end[/lua]
self.map:addObjectListener(“foodSpawn”, onFood)
what am I missing???
[import]uid: 31814 topic_id: 6472 reply_id: 306472[/import]