Legacy GM is mouse_wheel_up really the GML equivalent of Mouse Wheel Up event?

jobjorgos

Member
Below you see an example of the Mouse Wheel Up event that execute the script 'camera_zoom', and this works fine.


But below here you see an example of the Step event that does the exact same as in the script above. But somehow, THIS way with the step event and mouse_wheel_up in GML seems NOT to trigger at all.
Is the GML code mouse_wheel_up() really the equivalent of Mouse Wheel Up event??
 

NightFrost

Member
Short answer: yes. My controls manager I use in all of my projects uses mouse_wheel_* commands and I haven't had any issues. (GMS 2 though.)
 

jobjorgos

Member
Do you have an "exit" statement in the block above that script?
Nope! I did not even use the exit statement ever before in game maker, but I tried it and nothing changed too bad but it was a good idea of you to try!

Finaly after many many hours of experimenting and testing I discovered a solution, using the following script now:

Code:
if mouse_wheel_up(){
    if view_wview[0] <= 512{
        view_wview[0] = 544.2;
        view_hview[0] = 408.15;
    }else
    if view_wview[0] <= 544.2{
        view_wview[0] = 604.66;
        view_hview[0] = 453.5;
    }else
    if view_wview[0] <= 604.66{
        view_wview[0] = 671.85;
        view_hview[0] = 503.88;
    }else
    if view_wview[0] <= 671.85{
        view_wview[0] = 746.5;
        view_hview[0] = 559.87;
    }else
    if view_wview[0] <= 746.5{
        view_wview[0] = 829.44;
        view_hview[0] = 622.08;
    }else
    if view_wview[0] <= 829.44{
        view_wview[0] = 921.6;
        view_hview[0] = 691.2;
    }else
    {
        view_wview[0] = 1024;
        view_hview[0] = 768;
    }
}
Instead of multiplying/decreasing the view width/height by a percentage, I now adjust the view to a specific width/height depending on the current width/height
I still don't exactly know the reason why this works, but I dont mind and im just happy I can continue to the next step in my game now :)

And thanks for thinking along with me!
 
He didn't say for you to try using "exit", he was wondering if you were using it and ending the event prematurely so that the mouse check wouldn't even come to pass. :p

You haven't shown us the screen shake code yet so the issue still might exist within it, even if your fix is now producing results.
 

jobjorgos

Member
Code:
/// If Screen Shake is True, DO SCREEN SHAKE
if (global.screen_shake_ == true)  {
    x = target_.x+random_range(min_amount_, max_amount_)
    y = target_.y+random_range(min_amount_, max_amount_)
}

if global.screen_shake_==true{
    if room == rm_world64{
        if alarm[0]== -1{
            alarm[0]=90;
        }   
    }else{
        if alarm[0]== -1{
            alarm[0]=30;
        }
    }
}
So I guess no problems from this script
 
Top