GameMaker Can't Swap Code From File To File (Gesture)

T

twalkerp

Guest
I realized that I have my zoom in/out script for mobile backwards. I accidentally put zoom IN for pinch in, and vice versa with pinch out.

I figured I could just swap the code and be done, but it's acting extremely weird and doesn't want to work when I do that.

Any Ideas?


Current Pinch IN Gesture (zooms in, but should zoom out)
Code:
var _scale = event_data[? "relativescale"];
var _w = camera_get_view_width(view_camera[0]);
var _h = camera_get_view_height(view_camera[0]);
var _x = camera_get_view_x(view_camera[0]) + (_w / 2);
var _y = camera_get_view_y(view_camera[0]) + (_h / 2);

_w *= _scale;
_h = _w * (room_height / room_width);
_x -= _w / 2;
_y -= _h / 2;

camera_set_view_size(view_camera[0], clamp(_w,room_width/1.4,room_width/1.4), clamp(_h,room_height/1.4,room_height/1.4));
Current Pinch OUT Gesture (zooms out but should zoom in)
Code:
var _scale = event_data[? "relativescale"];
var _w = camera_get_view_width(view_camera[0]);
var _h = camera_get_view_height(view_camera[0]);
var _x = camera_get_view_x(view_camera[0]) + (_w / 2);
var _y = camera_get_view_y(view_camera[0]) + (_h / 2);

_w *= _scale;
_h = _w * (room_height / room_width);
_x -= _w / 2;
_y -= _h / 2;

camera_set_view_pos(view_camera[0], clamp(_x,0,room_width/2), clamp(_y,0,room_height/2));
camera_set_view_size(view_camera[0], clamp(_w,0,room_width), clamp(_h,0,room_height));
As mentioned, I tried just swapping the code but it does not work. Any ideas?

Thanks
 
Top