Hi guys
I've set my sprites anchor point to (0.5, 0.5) and put it in the middle of the screen.
Prop = Core.class(Sprite)
function Prop:init(atlas, texture, x, y, container)
local sprite = Bitmap.new(atlas:getTextureRegion(texture, true))
sprite:setAnchorPoint(0.5, 0.5)
sprite:setPosition(x, y)
self:addChild(sprite)
container:addChild(self)
end |
When I try to scale the sprite down tho (inside the scene), it seems to be scaled into a corner of the screen.
function Scene1:onTransitionInBegin()
createContainers(self)
self.hole = Prop.new(self.pack, "splashHole.png", 160, 224, mg)
self.hole:setScale(0.25, 0.25)
end |
It works when I set scale within the class itself.
Am I doing something wrong?
Thank you in advance for any help!
Comments
1. in general a bitmap i would call bitmap and not sprite, it's easier to keep track i guess
2. i've seen somebody recommender using this container in the init, personally i think it's easier to keep track if you add the prop afterwards to the appropriate sprite, so leaving out container and the last line of init and adding after
Fragmenter - animated loop machine and IKONOMIKON - the memory game
Fragmenter - animated loop machine and IKONOMIKON - the memory game
I understand now how it all works. Thank you heaps for your help
I'm using another engine as well at the moment, and thing work slightly differently.
Thank you again!