P
PWL
Guest
I need to keep all my players in the view and want to scale my view down so that everyone is shown. (Yes, Super Smash Bros. style)
This is how far I've come.
I manage to get the view to keep them both inside the view, but I don't know how I can keep the aspect ratio correct and still keep them inside the view. I don't know if it's the horizontal or vertical size that should push the view bigger. If that made sense. In other words, is the players x-values pushing the boundaries of the view, or their y-values?
Thanks in advance.
This is how far I've come.
Code:
// The span-functions gets the distance in pixels between the min and the max x-values of the players
var span_x = camera_get_span_x();
var span_y = camera_get_span_y();
// Center view around them
view_xview[0] = camera_get_average_x() - (span_x/2);
view_yview[0] = camera_get_average_y() - (span_y/2);
// Set width and height, which breaks my aspect ratio
view_wview[0] = span_x;
view_hview[0] = span_y;
Thanks in advance.