• 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 Sprite interaction

B

Borschik

Guest
Let's say I want to have my character to grab an enemy and throw him away. How do I approach that? Do I need to draw a sprite that have both character and an enemy in it, and then replace both original sprites with this merged one for the duration of animation?

Or should I draw two different sprites? With enemy flipping in the air pretending to be grabbed, and character grabbing air, and then align them together somehow? But then what if animation requires some varying overlapping (character's leg needs to be behind enemy sprite and an arm in front)?

Or maybe it's better described by an easier example. I want character to pick up a rock from the floor and throw it away.
 

Xer0botXer0

Senpai
The whole a character walking over to a rock, picking it up, drawing his arm back and throwing it sky high can be an animation. absolutely no coding required.
Frame by frame this can be done.

For a character grabbing an enemy and throwing him away, Im thinking street fighter, Player 1 presses "G" which is a keybind for grabbing, he will go from idle hoping from one foot to another to extending his two arms out whilst leaning forward. If the second player is not within reach then he will simply retract which could be the reverse of that animation or an animation on its own. If the other players character is within reach/range then play the pulling enemy over the shoulder animation. using the first characters pulling over shoulder to throw the enemy down animation as a reference to show how the enemies character should be animated. Once again you can use code to move the enemy character up a bit and perhaps rotate the animation or just animate that part entirely. Depends on your preference.
 
B

Borschik

Guest
The whole a character walking over to a rock, picking it up, drawing his arm back and throwing it sky high can be an animation. absolutely no coding required.
Frame by frame this can be done.

For a character grabbing an enemy and throwing him away, Im thinking street fighter, Player 1 presses "G" which is a keybind for grabbing, he will go from idle hoping from one foot to another to extending his two arms out whilst leaning forward. If the second player is not within reach then he will simply retract which could be the reverse of that animation or an animation on its own. If the other players character is within reach/range then play the pulling enemy over the shoulder animation. using the first characters pulling over shoulder to throw the enemy down animation as a reference to show how the enemies character should be animated. Once again you can use code to move the enemy character up a bit and perhaps rotate the animation or just animate that part entirely. Depends on your preference.
Thank you for you answer, it is making things clearer for me.

Let's say character is grabbing an enemy with his hands and doing a throw or something. That means that one of characters hands should be in front of an enemy sprite and second one behind it (if we see it from the side). I think it is possible to show in front or behind another sprite only the whole character's sprite while using depth.

Does it mean that two objects can both have one temporary merged sprite and then disengage into two? Or I need to hide sprites of both objects and have a separate object for this animation to appear in their place and then somehow make original objects to appear at new coordinates?
 
P

Palocles

Guest
Did you figure this out?

You’ll need an animation for the player grabbing and throwing and another animation for the enemy being grabbed and thrown. You can make the grabbed enemy move with the grabber and it should save you some work in the art department by separating them. Though you might have to seperate your enemies into different size groups and have them move differently.

The hand in behind I would think you just don’t draw. Or you make it so the hands are on the edge of the enemy not wrapped around them.
 
Top