Legacy GM [Solved] Help creating a rotation system from an old game?

Discussion in 'Programming' started by Wazkat, Feb 16, 2017.

  1. Wazkat

    Wazkat Guest

    Hello,

    There is an old game, Madness Interactive

    I'm looking for some help on recreating the hand rotation within this game

    [​IMG]

    Here is a gameplay video of the game I found



    So yes I am looking for a way to recreate the hand rotation system it has, if it is possible.

    Looking if it's possible for Legacy GM, but I also have GM:S 1.4

    I do not know where to start in creating this, but if it helps, here is what the coding appears to be, but this is not in GML

    Code:
    x = _x-_root._xmouse;
    y = _y-_root._ymouse;
    _rotation = -Math.atan2(x, -y)/(Math.PI/180);
     
  2. jo-thijs

    jo-thijs Member

    Joined:
    Jun 20, 2016
    Posts:
    2,844
    Hi and welcome to the GMC!

    If we're ignoring the hand animations (that happen when e.g. there's a recoil effect from a gun),
    I think it can be done like this:
    Step event of hand object:
    Code:
    x = mouse_x;
    y = mouse_y;
    
    var cx = obj_player.x;
    var cy = obj_player.y;
    
    var d = point_distance(x, y, mx, my);
    var m = 64;
    
    if d > m {
        x = mx + (x - mx) / d * m;
        y = my + (y - my) / d * m;
    }
    
    image_xscale = obj_player.image_xscale;
    
    image_angle = point_direction(mx, my, x, y);
    
    if image_xscale < 0
        image_angle += 180;
    Although I'm not sure if that's how the mouse input in the game works (as I've never played that game).
     
  3. Wazkat

    Wazkat Guest

    Hello, so that works and was what I was looking for - just the hand movement.

    Thank you.
     
  4. TheouAegis

    TheouAegis Member

    Joined:
    Jul 3, 2016
    Posts:
    6,787
    I loved the Madness animations. If you like Madness, watch the John Wick movies. John Wick Chapter 2 had some fights I remember seeing in the Madness series.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice