GameMaker Controlling The View

P

Pyxus

Guest
So in my rpg game I had an idea for the camera zooming in and out as a stylistic choice so that if you were, for example, selecting a player the camera would zoom in slightly towards that player, and if you then select the "move" option the camera would zoom out. I figured the best way to do this would be to have the view follow a camera object and the camera object changes the view depending on if you're selecting a player, or selecting an action. Exact numbers aren't necessary I just need to understand what i'd have to do to achieve my desired effect. I think I may have the right idea but so far room_set_viewpoty, camera_set_view_size, and camera_set_view_border, don't seem to do anything when I play with the numbers. Then again i'm pretty much an amateur and could just be doing something wrong.

Here is all the relevant code... if you need any more information to assist me I'll post it in a heartbeat.
Code:
/// @description Move Toward Player
///Move 10% towards the player
if (in_combat)
{
    if(is_selecting_player)
    room_set_viewport(rm_battle, 0, true, 0, 0, 640, 480) //Messing Around With Function
    camera_set_view_size(obj_view,10, 10) //Messing Around With Function
    camera_set_view_border(obj_view, 10, 10) //Messing Around With Function
    x += (player_party[player_chosen].x - x) * .1;
    y += (player_party[player_chosen].y - y) * .1;
}
 
P

Pyxus

Guest
@TheouAegis: view_wview and view_hview are no longer available in GMS 2.

@Pyxus: Use camera_set_view_size() to change the view size.
http://docs2.yoyogames.com/source/_build/3_scripting/4_gml_reference/cameras and display/cameras/camera_set_view_size.html
Thanks for pointing that out, though my mistake seems to be caused by my own stupidity ;P, I was using
obj_view instead of view_camera[0]. By the way... I have a quick question if you're willing to answer/have an answer. In short I want to create a zoom effect and figured I could do this by increasing the width and height values until they reach the desired value but I'm not sure how best to do that. I'll probably find a solution through a bit of trial and error if not simply google, but it would save me some time. Thanks in advance!

Code:
    if(is_selecting_player)
    {
    camera_set_view_size(view_camera[0], 1020, 716)
    camera_set_view_border(view_camera[0], 800, 540)
    x += (player_party[player_chosen].x - x) * .1;
    y += (player_party[player_chosen].y - y) * .1;
    }
    if(is_selecting_from_menu)
    {
    camera_set_view_size(view_camera[0], 800, 540)
    camera_set_view_border(view_camera[0], 800, 540)
    x += (player_party[player_chosen].x - x) * .1;
    y += (player_party[player_chosen].y - y) * .1;
    }
 
Top