Hi, i am trying to implement camera 2D with gideros. i'm having difficulty in scaling in certain point, for now gideros always scale sprite from (0,0). the camera will have basic functionality like, zoom, move, convert screen coordinate to world coordinate, flick, and able to move to certain point with easing.
Have anyone already implement something like this?
and how can i scale sprite from certain point?
and should i try to implement it with matrix or should just use what gideros Sprite function has?
thank you
Comments
It was set to be available in the next release but it appears that :
However, you will find some solutions in the link that I have given above [ Link ]
Also, I don't know if it's relevant to your needs but have you seen that article from @ar2sawseen -> Gideros Camera Move
actually, i've tried similar idea by using bitmap instead of sprite. and i set anchorpoint to arbitrary number (example 0.5, 0.5) but the bitmap still scaled from the top left corner
i previously code game for c# using SLXNA(hybrid of silverlight and XNA), so im used to handle all of the drawing by myself(in gideros , its handled automatically by the engine right?) and use the matrix in camera.
but of course i'll try that one first
i tried this code :
local oldSetPos = Sprite.setPosition
Sprite.setAnchorPoint = function(self, ax,ay)
self.ax = ax
self.ay = ay
end
Sprite.setPosition = function(self, x, y)
local newX = self:getX() - (self:getWidth() * self.ax)
local newY = self:getY() - (self:getHeight() * self.ay)
oldSetPos(self, newX, newY)
end
but it seems its only for translation
but thanks for the answer anyway!
the anchor point should be for translation, rotation, and scaling
»Gideros Illustrator« - [svg|xml] scene designer using Adobe Illustrator®™ Within one line of code!
we're in the same boat!
Now I need to add setRotation and think about Sprite inheritance... I post the class here on the forums, when I'm done.
»Gideros Illustrator« - [svg|xml] scene designer using Adobe Illustrator®™ Within one line of code!
Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
Cool Vizify Profile at https://www.vizify.com/oz-apps
But if you are interested, the rotation problem was solved
http://www.giderosmobile.com/forum/discussion/1466/overriding-class-methods
Wondering if it's faster to just set the rotation back to do the calculations under the hood.