• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GML Body part postion tracking

Z

ZionSpelunker

Guest
So I'm just getting back into gml with a cool game idea (although I never got too deep into gml at all) and I'm wondering how I might be able to make a left and a right hand object stay in the correct position and orientation in front of the body object hopefully with a bit of room for the hands to bounce around a bit if hit (although maybe not if it gets to complex). Anyone got any ideas for simple implementation of this? I also need this to work for several entities at once, many body objects with 2 hands each.

Thanks for the help :)
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
2D? 3D? Platformer? Top Down? Isometric? I confess to not having a clue what it is you are really asking... :p Maybe make a mockup screenshot or something to help give us an idea?
 
M

Monsi

Guest
The objects can`t be tracked, they have to be placed.
Which means, you have to manually place the object on the hand position and change it with every sprite.
And yes, this means lots of objects and lag.
What?
 
Z

ZionSpelunker

Guest
2D? 3D? Platformer? Top Down? Isometric? I confess to not having a clue what it is you are really asking... :p Maybe make a mockup screenshot or something to help give us an idea?
Sorry my bad for not stating that it would be a top down 2d game with very simple graphics, just for simplicity

The objects can`t be tracked, they have to be placed.
Which means, you have to manually place the object on the hand position and change it with every sprite.
And yes, this means lots of objects and lag.
is it not possible to have an object look at the position and angle of another object and have it move accordingly? I would think that would be possible I'm just not entirely certain how.
 
D

dannyjenn

Guest
You don't need a ton of objects. Your character just needs some additional variables: left_hand_x and left_hand_y and right_hand_x and right_hand_y. In the character's end step, update these variables such that they are where you want them, relative to the character (if you design the sprites such that they're already lined up with the character's sprite, then this should be simple. If not, you may need to use some trig). Then use draw_sprite_ext() three times (once for the character, once for the right hand, and once for the left hand).

If you want the hands to bounce back when hit, you'll need more code. But it's doable.

edit - I also don't think it'll cause lag, but it will be a little slower (since you need to draw thrice the sprites).
 
Top