|Topic was automatically imported from the old Question2Answer platform.
I’m designing a game level
So I use the editor to position and scale both pictures visually (in
The background is wider than the silhouette, I position them manually relative to each other plus individual scaling.
background has a scale of 1.1, the silhouette a scale of 0.8
After that, I add my level to the game:
So I now positioned manually the
game_ui and also apply a scale to the whole
level_1 scene (0.5)
I also placed my playground above the
game_ui with some offset too.
Now I want to crop the visually displayed background of
level_1 image to the size of my game area the playground:
The difficulty is to apply the transform of each node scaled and positioned correctly…
I managed to find the values, by manipulating directly is the game by adjusting by hand:
clip_w = play_area.points.x * ratio
clip_h = play_area.points.y * ratio
clip_zone = Rect2(
level_bg.position = offset_position
Now how do I transform the size of the playground, to the (
I found this one :
ratio = 1 / (level_bg.scale.x * level_1.scale.x)
But I can’t figure out how to compute the
clip_offset nor the
offset_position of the clipped background inside
I think it could be achieved by a applying some Transorm2D but I don’t know how.
Do you have some hint for me?
Use a Camera2D node to select what’s on the actual screen when the game is running
A112Studio | 2020-05-09 15:21