Changing image

I created object:

local object = display.newImageRect("Images/object.png", 50, 50)

can I change image used for object or the only way is to remove old object and replace it with new one?

(Post updated by moderator. Please format code in posts.)

You could create a simple newRect and give it multiple image fills, or create a sprite and change the frame as needed.

2 Likes

@ConveyedRex7592 adding to what @XeduR said, you can explicitly do this:

local object = display.newImageRect("Images/object.pnge", 50, 50)


object.fill = {  type = "image",  filename = "texture1.png" }
2 Likes

Thanks :slight_smile:

thanks for example :slight_smile: