Hi!
Okay, I’m making a game which I need to work on various re-scaled screen sizes without distorting the images. Right now I have it so that images are scaled (both their x and y sizes) according to the height of the window, which is the desired behaviour.
Here’s what I’d like it to look like:
Notice how the labels are positioned at 25%, 50% and 75% of the window height.
But when I resize the screen, this happens:
The labels stay in the correct positions (25%, 50%, and 75% of the window height) but the hands disappear! Both the labels and the sprites are part of the same game object.
Another image:
The hands change scale correctly, as far as i can tell, but even though their y-position is always 0 (both the game object and the sprite itself), they seem to drift away from the label.
here’s the code I’m using to rescale the sprites and move everything to the right place.
> local function callback(self, event, data)
> if event == window.WINDOW_EVENT_RESIZED then
> self.screenwidth = data.width
> self.screenheight = data.height
> end
> print(self.screenwidth.." "..self.screenheight)
> self.scale = (self.screenheight*0.00060)
>
> for i=1,6 do
> go.set_scale(self.scale, "/arm"..i.."#sprite")
> local aa = go.get("/arm"..i.."#sprite", "size.x")
> self.armsize = aa*self.scale
> print(self.armsize.."scaled armsize")
> end
>
> --scale and position players
> self.topl = vmath.vector3(100, self.screenheight*0.75, 0.4)
> self.midl = vmath.vector3(100, self.screenheight*0.5, 0.4)
> self.botl = vmath.vector3(100, self.screenheight*0.25, 0.4)
> self.topr = vmath.vector3(self.screenwidth-(100), self.screenheight*0.75, 0.4)
> self.midr = vmath.vector3(self.screenwidth-(100), self.screenheight*0.5, 0.4)
> self.botr = vmath.vector3(self.screenwidth-(100), self.screenheight*0.25, 0.4)
> go.set_position(self.topl, "/pl1")
> go.set_position(self.midl, "/pl3")
> go.set_position(self.botl, "/pl5")
> go.set_position(self.topr, "/pl2")
> go.set_position(self.midr, "/pl4")
> go.set_position(self.botr, "/pl6")
> end
any help??