1. Hey! Guest! The 36th GMC Jam will take place between February 27th, 12:00 UTC - March 2nd, 12:00 UTC. Why not join in! Click here to find out more!
    Dismiss Notice

GM:S 1.4 is mouse_wheel_up really the GML equivalent of Mouse Wheel Up event?

Discussion in 'Programming' started by jobjorgos, May 23, 2019.

  1. jobjorgos

    jobjorgos Member

    Joined:
    Jun 23, 2016
    Posts:
    162
    Below you see an example of the Mouse Wheel Up event that execute the script 'camera_zoom', and this works fine.
    [​IMG]

    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??
    [​IMG]
     
  2. NightFrost

    NightFrost Member

    Joined:
    Jun 24, 2016
    Posts:
    2,095
    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 likes this.
  3. Binsk

    Binsk Member

    Joined:
    Jun 22, 2016
    Posts:
    653
    Do you have an "exit" statement in the block above that script?
     
  4. jobjorgos

    jobjorgos Member

    Joined:
    Jun 23, 2016
    Posts:
    162
    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!
     
  5. BattleRifle BR55

    BattleRifle BR55 Member

    Joined:
    Jun 24, 2016
    Posts:
    1,074
    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.
     
  6. jobjorgos

    jobjorgos Member

    Joined:
    Jun 23, 2016
    Posts:
    162
    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
     

Share This Page