• 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!

Legacy GM Action Platformer Shooting Animation

S

steenert

Guest
Hey people,

Lately I have been looking around on a good way to implement shooting animations into my game. But I cannot find any good resources on how to do this. All the guides and tutorials I find on how to implement this are form a top-down perspective. The shooting itself isn't the issue but the animations give me a real headache.

I've tried numerous methods that include swapping to another object with parenting properties but somehow my characters doesn't move when shooting. Long story short, does anyone have any valuable tips or resources I can check out?

Thanks in advance! :)
 
A

anthropus

Guest
i recommend using scrips/states to control your player's animation and behavior.when i learned how to make finite state machine it made coding itself much easier. look at and do all the youtube tutorials on "states" and "scrips"
 
S

steenert

Guest
i recommend using scrips/states to control your player's animation and behavior.when i learned how to make finite state machine it made coding itself much easier. look at and do all the youtube tutorials on "states" and "scrips"
oh I know what a finite state machine is, I use one for movement , ledge grabbing and ladders. I just cannot find a working method to get my character to shoot and animate while doing it without stopping his movement.
 

Yal

šŸ§ *penguin noises*
GMC Elder
I've always liked how you DON'T need to worry a lot about animations when guns are involved, you'd just spawn objects at the gun muzzle. But I guess showing some recoil and whatnot makes it feel like there's more weight to it.

You can have parallel state machines (gunstate & character state), it's a bit complicated but shouldn't be too hard to set up. The gun state would control what spirtes are shown at the gun muzzle, what angle the gun is drawn at, and such, and be handled independent of the main state.
 
S

steenert

Guest
I've always liked how you DON'T need to worry a lot about animations when guns are involved, you'd just spawn objects at the gun muzzle. But I guess showing some recoil and whatnot makes it feel like there's more weight to it.

You can have parallel state machines (gunstate & character state), it's a bit complicated but shouldn't be too hard to set up. The gun state would control what spirtes are shown at the gun muzzle, what angle the gun is drawn at, and such, and be handled independent of the main state.
The thing is, my character is using a bow. and a non-animating bow just doesn't feel right to me. I find it hard to find a way to code a state that can shoot and walk at the same time.
 
A

anthropus

Guest
oh I know what a finite state machine is, I use one for movement , ledge grabbing and ladders. I just cannot find a working method to get my character to shoot and animate while doing it without stopping his movement.
in one of my scrip-states i use this code to stop animations. it may not be the best way to do things (im a noob), but its just something that i came up with to help control the sprites. hope it gives you some ideas!
Code:
//make last frame hold
if (image_index==2)
{
image_speed=0;
}

//go back to idle
if (o_par_ice_scepter_melee.image_index==5)
{
current_state=celes_state.idle;
}
 
A

AnonyMouse

Guest
Something like this? Shooting units have a recoil but it is hard to see and some units are not correct so they are sliding :)
I am using a variable attack and when the enemy is out of range it is 0, then the sprite is sprite1 (animated), it is also moving towards the enemy with speed=1, when in range is attack=1 and sprite2, also animated, it is moving towards the enemy with speed=0. If you want also to walk and shoot you will need attack=2 and then sprite3 if I understand you correctly.
 
S

steenert

Guest
Both examples are interesting only I wonder how you all manage the animation speed, I have gotten to a state where my character will shoot + animate when clicking the right button. But the speed the image is played at is super quick.

Any tips?
 
S

steenert

Guest
You can use image_speed=0.2
That only changes the image_speed of my idle sprite, it does nothing to the attack animation sprite :(
Code:
// Attack State
scr_input()

Writer.state_text = "attack_state";

if (bullets > 0 ) {
    
    b =(instance_create(x + dir*12, y-10, obj_bullet1));
    b.speed = 10 * dir;
    
    sprite_index = spr_character2_shoot;
    image_speed = 0.1;
    
}
Is what i'm using now, it's basic but I want to figure this problem out before I make it more complicated.
 
Last edited by a moderator:
A

anthropus

Guest
maybe a switch statement?

switch (state)
{
case idle:
sprite_index=...
image_speed=...

case running:
sprite_index=...
image_speed=...

//and so on
)
 
S

steenert

Guest
I decided to use a diff FSM because my own one was lacking, I have everything working now :) Thanks everybody.
 
Top