R
redman
Guest
How do I zoom out (everytime the Player grows in size)? Is there a code to set the "View in room"?
Thank you. Any way to avoid malformed pixels?you can increase view_wview and view_hview to expand the view on screen! ;o
(may result in malformed pixels)
kind of.Any way to avoid malformed pixels?
Thanks!kind of.
if you're zooming out by fractions/decimals, then... no.
however, you can avoid malformed pixels by using whole numbers
e.g.
multiplying by 2 (decimals like x1.5 will cause malformed pixels)
multiplying by 3
multiplying by 4
multiplying by 10
It's really only a problem if your game is really far zoomed out like risk of rain.
if you have a zoomed in view - like in super mario, nuclear throne, or undertale - then it's not even noticable and I wouldn't worry! ;w;
///camera_zoom(x_scale, y_scale, steps, percentage, inside);
// Zooms the camera by the given factor over given amount of steps.
// Make sure global.camera_index have been initilazied by using camera_setup().
// x_scale = Scale factor for the x value of camera.
// y_scale = Scale factor for the y value of camera.
// steps = Number of steps for the zoom effect to complete.
// percentage = If scaling is percentage (True) or a size value (False).
// inside = Whether the camera will be clamped inside room (True) or allow outside (False).
// Dependencies: eng_camera_zoom, global.camera_index
//Creates variables.
var x_scale = argument0;
var y_scale = argument1;
var steps = argument2;
var percentage = argument3;
var inside = argument4;
var index = global.camera_index;
//Check if scaling is percentage.
if percentage
{
//Calculates value of new scale.
var x_value = view_wview[index] * x_scale;
var y_value = view_hview[index] * y_scale;
}
else
{
//Sets value of the scale.
var x_value = x_scale;
var y_value = y_scale;
}
//Calculates delta.
var x_delta = x_value - view_wview[index];
var y_delta = y_value - view_hview[index];
//Calculates step value.
var x_step = x_delta / steps;
var y_step = y_delta / steps;
//Create camera object.
var obj = instance_create(x, y, eng_camera_zoom);
//Sends over variales.
with obj
{
self.inside = inside;
self.x_step = x_step;
self.y_step = y_step;
self.index = index;
alarm[0] = steps;
}
///Suicide
instance_destroy();
///Handles Zoom Effect
//Updates view port.
view_wview[index] += x_step;
view_hview[index] += y_step;
//Centers the camera.
view_xview[index] -= x_step / 2;
view_yview[index] -= y_step / 2;
//Check if inside.
if inside
{
//Clamps values inside room.
view_xview[index] = clamp(view_xview[index], 0, room_width - view_wview[index]);
view_yview[index] = clamp(view_yview[index], 0, room_height - view_hview[index]);
}