• Hey! Guest! The 40th (!!!) GMC Jam will take place between February 25th, 12:00 UTC to March 1st 12:00 UTC. Why not join in this very special anniversary jam! Click here to find out more!

Arms for my 2d shooter?

ETHC33

Member
Hello, I’m 14 ( not very intelligent with gml) so simple answers would be appreciated:
I’ve been following a Shaun Spaulding plattformer tutorial which has been great but the gun held by a character aims by following the mouse pointer. I like that but it seems very hard to attach arms onto it since they’d have to move with the gun. I moved the orgin from middle center to the shoulder of the arm I drew holding the gun, so basically I got one arm to work but I can’t do the other one. I know I’m horrible at explaining this so look at part 3 of the plattformer shooting game. Thanks so much for your time and answers. 😊
 

Slyddar

Member
14 is a good age to start, so keep working on games and you'll get there.

Most 2D shooters get away with just drawing the gun in front of the player with some hands drawn in front of the gun, making it look like they are holding it. Keep the origin in the middle of the gun, and draw it at the players center, but also add a 2-4 pixels via lengthdir_x and lengthdir_y to the x and y position to make it appear slightly in front of the center position, which is usually enough to complete the illusion.
 

ETHC33

Member
Thanks slyddar! i'm a big fan I bought your Udemy course and plan to do it after this one. I had him with no arms before just the hands, but I made my main character 84x84. it really just didn't look great like shaun's did. I was able to add one arm by moving it to the top left then adjusted the center point of the bullet so it looks right now. It looks good when the gun is held forward but when I move the image angle of the gun past a certain point it flips horizontally and you can clearly see his little nub of a shoulder. Maybe when the image angle > number I could have it switch to a sprite with an arm? I'm not fluent in gml yet because i just stoppped using scratch. also eventually i want to switch between a sword and the gun, so if i had arms with the sword not the gun it'd look a little wierd. If i can figure it out i'll attach a video
 

ETHC33

Member
Just to clarify id really like if someone could Come up with a better solution, my way is tedious and probably won’t work,
 
Top