I have a sprite and I want to change it's texture, but I can't use a MovieClip because I have to work with it's anchor point,size position, etc...So is there a way to change a sprite's texture more directly?
Hi, it all depends on how you are doing it right now, but there are some ways to the same result. A code snippet would help to help Ie: Add the bitmap you're using as a texture for the sprite as a property of your sprite, so that you can change it without killing the parent sprite
In my original code, I have to change the texture in a loop if a specific variable value follows some patters, but I doesn't matter. The point is, I need to change the image without changing the current properties. So can you give me a bit more specific details on how to do that? Sorry but I am kinda new to Gideros
Code example snippet:
local ninja = Bitmap.new(Texture.new("Personaje/i1a.png"))
ninja:setScale(0.3,0.3)
ninja:setPosition(350,800)
ninja:setAnchorPoint(0.55,0.84)--change image here to another image, keeping the same properties
Comments
Ie: Add the bitmap you're using as a texture for the sprite as a property of your sprite, so that you can change it without killing the parent sprite
In my original code, I have to change the texture in a loop if a specific variable value follows some patters, but I doesn't matter. The point is, I need to change the image without changing the current properties. So can you give me a bit more specific details on how to do that? Sorry but I am kinda new to Gideros
Code example snippet:
Likes: keszegh, misterhup, pie