J
Joe Banko
Guest
I have 2 scripts:
zoom_in.gml
var cam = view_get_camera(0);
var xx = camera_get_view_width(cam);
if xx == 1024 {
camera_set_view_size(view_camera[0],512,256);
}
if xx == 2048 {
camera_set_view_size(view_camera[0],1024,512)
}
and zoom_out.gml
var cam = view_get_camera(0);
var xx = camera_get_view_width(cam);
if xx == 1024 {
camera_set_view_size(view_camera[0],2048,1024);
}
if xx == 512 {
camera_set_view_size(view_camera[0],1024,512);
}
zoom_in is called when I press pagedown and zoom_out is called when I press pageup. But the code never executes anything but the xx == 1024 branch. I am baffled by this and have tried using an else if between the two statements as well as changing the ordering i.e. in zoom_in checking xx == 2048 before xx == 1024, I was still getting the same result. Going into the debugger I found that xx always equalled 1024 even though on the screen I could see the changes going between 2048 and 512.
Any ideas/suggestions?
Thanks, Joe B
zoom_in.gml
var cam = view_get_camera(0);
var xx = camera_get_view_width(cam);
if xx == 1024 {
camera_set_view_size(view_camera[0],512,256);
}
if xx == 2048 {
camera_set_view_size(view_camera[0],1024,512)
}
and zoom_out.gml
var cam = view_get_camera(0);
var xx = camera_get_view_width(cam);
if xx == 1024 {
camera_set_view_size(view_camera[0],2048,1024);
}
if xx == 512 {
camera_set_view_size(view_camera[0],1024,512);
}
zoom_in is called when I press pagedown and zoom_out is called when I press pageup. But the code never executes anything but the xx == 1024 branch. I am baffled by this and have tried using an else if between the two statements as well as changing the ordering i.e. in zoom_in checking xx == 2048 before xx == 1024, I was still getting the same result. Going into the debugger I found that xx always equalled 1024 even though on the screen I could see the changes going between 2048 and 512.
Any ideas/suggestions?
Thanks, Joe B