1) When two different images are placed on top of each other with the same color I can differentiate between them because there's a border, but I want them to look like one image? How?
2) Okay...this one. I have an image1 that I resize to another image(image2)'s scale so it keeps its size relative to image2 and then position image1 so that image2 appears in the middle of image1.
But now my problem is that I want to rotate image2 around its center so that it spins(like a compass, not a spinning ball attached to a rope) but it's not working
Code: Select all
function resizeImage(img, nW, nH, extra)
--should be no problems here
local cw, ch
if type(img) == "string" then
img = game:getSource(img)
end
if type(img) == "number" then
cw, ch = img, nW
nW, nH = nH, extra
else
cw, ch = img:getDimensions()
end
cw = nW/cw
ch = nH/ch
return cw,ch
end
--parentSource resolution = 160x256, image2
self._w, self._h = resizeImage(parentSource, parent.w, parent.h)
-- so larger image would appear in the middle of parentImage, surrounding it
local x = self.x-self._w*80
local y = self.y-self._h*128
local vw = source:getWidth()/(2+2)
local vh = source:getHeight()/(2+2) --?? 4 instead of 2 because of scale, see below
--image1, source resolution = 320x512, aka 2 times source
love.graphics.draw(source, x,y, angle, self._w, self._h, vw, vh)