Since all sprites are changed in the player's End Step event, then you must change in that event.
1 - Go to the player's End Step event.
2 - Go to the
case player_state.jump
section in the
p_state
switch;
3 - Notice that there is a variable called
sprite_index = spr_pl_normal_jump
. You will delete this line and change the sprites as each jump changes through the
jump_count
variable.
The first thing you need to know is that there is a variable called
jump_count
, if you set the amount of jumps to 2, then the variable
jump_count
will be 2 while you are jumping, subtracting -1 from this variable, until reach 0 and there are no more jumps. Then you will use this to your advantage. Use a
switch
for each number, you change the sprite, like this:
GML:
case player_state.jump:
switch (jump_count)
{
case 1:
sprite_index = spr_pl_normal_jump; //player sprite jump first time
break;
case 0:
sprite_index = spr_pl_normal_jump_impulse; //player sprite jump impulse
break;
}
if (wall_jump_delay == 0) {if !(input_h == 0) image_xscale = input_h;} //flip player
image_speed = 0; //sprite speed
if (vsp > 0) {image_index = 1;} else {image_index = 0;} //jumping or falling
break;
If the
jump_count
was 2, when jumping, it automatically goes to 1, so this is why the first value of the switch is 1.
Note that the
image_index
is changed as the player is jumping "up" or "down" (using the
vsp
variable), if your player modifies the jump as an animation, just change these values as needed.
If your character wears different "outfits" (which are the skills), you will need to do this for all skills, as they are different sprites.
4 - Result:
The black and white sprite would be the sprite you want to change with the next jump in the air. If you want to modify the jump sound as well, just use a switch using the
jump_count
variable in the step event, in the same place where the jump is made and the sound is played, just modify it.
------------------
Any sprite changes are made in the End Step event, so you need to modify that there.
1 - Enter the player's End Step event.
2 - Locate the part where the shooter sprites are changed:
Notice that there is a switch, you will have to modify it as your project is going, but let's assume that you are doing this while the player is stopped, so you will make changes to the
case player_state.idle:
.
Notice that there is a line of code containing this:
GML:
image_speed = 0.2; //sprite speed
Just create a time variable that will increase according to what you want, but you will have to do it because I don't know how your project works. If the time variable reaches a certain value, the animation of the sprite will play.
------------------
I think I understand, but can you show me a video just so I can understand better? I can do this. I never played Mega Man games, so I don't know...
Also, my college classes are back, so I might be slow to do that, but I will try to do my best.
Thanks.
Regards.