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

W

Wazkat

Guest
Hello,

There is an old game, Madness Interactive

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



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);
 

jo-thijs

Member
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).
 
W

Wazkat

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

Thank you.
 

TheouAegis

Member
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.
 
Top