K
Kid Mescudi
Guest
Hello all!
First off, I'm fresh to GML (after doing nothing but D&D) so excuse my lack of understanding of particular terminology.
Basically, my problem is that I have a top-down game where the character swings his sword. Once the animation stops, it returns back to a default still sprite. Right now, I can get it to work if the player is not moving. But if I'm moving AND want to attack, the sprite just shows as the second sub-image (it's only a 4-frame animation for the sword swing).
Here is what I have in the STEP script:
///Attacks
if keyboard_check_pressed(vk_space){
sprite_index = spr_player_attack_right;
image_speed = 0.5;
image_index = 0;
}
And here is what I have in my character's ANIMATION END script:
///Sprite Changes
//Attack with sword
if sprite_index = spr_player_attack_right {
image_speed = .5;
image_index = 0;
sprite_index = spr_player_right;
}
--------------------------------------------
Now I based these scripts off a topic I searched from this year, and it works up until if I wanted to, say, move my character to the right AND press the SPACE bar at the same time to perform a fully animated swing.
Does anyone know where I'm going wrong? Any help is appreciated!
First off, I'm fresh to GML (after doing nothing but D&D) so excuse my lack of understanding of particular terminology.
Basically, my problem is that I have a top-down game where the character swings his sword. Once the animation stops, it returns back to a default still sprite. Right now, I can get it to work if the player is not moving. But if I'm moving AND want to attack, the sprite just shows as the second sub-image (it's only a 4-frame animation for the sword swing).
Here is what I have in the STEP script:
///Attacks
if keyboard_check_pressed(vk_space){
sprite_index = spr_player_attack_right;
image_speed = 0.5;
image_index = 0;
}
And here is what I have in my character's ANIMATION END script:
///Sprite Changes
//Attack with sword
if sprite_index = spr_player_attack_right {
image_speed = .5;
image_index = 0;
sprite_index = spr_player_right;
}
--------------------------------------------
Now I based these scripts off a topic I searched from this year, and it works up until if I wanted to, say, move my character to the right AND press the SPACE bar at the same time to perform a fully animated swing.
Does anyone know where I'm going wrong? Any help is appreciated!