Smooth camera zoom-out.

Right now i'm trying to make a Spore-like mini game to pratice some things and... i'm stuck.

I need a câmera system that follows the player and zoom out each time player grows up.

I have this:
------------------------------------------------------------------------
Webp.net-resizeimage.gif
--------------------------------------------------------------------------

All i want to do is to create a zoom out effect animation, to be smooth, not just to jump backwards like this.

To control the camera im using this:

In obj_player > Create event i have its variables:

camD = 1; //For camera distance
camDiv = 4; //For camera division (i tried this to keep player on the center but i think my math is a mess (i really need help with this))

In obj_player > Step event i use this to set camera:

GML:
camera_set_view_size(view_camera[0],576*camD,324*camD);
camera_set_view_pos(view_camera[0],x - (view_wport[0]/camDiv),y - (view_hport[0]/camDiv));
For it to grow up i have this:

GML:
if(place_meeting(x,y,obj_food)){
    fd = collision_point(x,y,obj_food,true,false);
    instance_destroy(fd);
    _growth++;
    size+=0.1;
    camD+=0.1;
    camDiv-=0.1;
    }
I just need a way to create a smooth camera animation and keep player at the center.
I hope someone can help me with this.
 

Nidoking

Member
You just need to set a target size and increase the size gradually each step if it's less than the target size.
 
Top