J
Jessiker
Guest
I'm sure this has been answered a million times, but I don't have time to go through all these threads...
Anyways, I want my sprite to have a jumping animation and a falling animation. However, both of the sprites are separate (one falling, one jumping). The falling sprite is the only one that has the animation. Besides that, I also added an idle animation and a running animation. I followed a tutorial but unfortunately it didn't explain to me what I should do if I have more than one frame for my sprite.
Here is the line of code that I used:
//Main Animations
if (!place_meeting(x, y+1, JURRASIC_GROUND)) or (!place_meeting(x, y+1, JURRASIC_GROUND_UP))
{
sprite_index = Jacklynn_Jumping_BARE;
if (sign(vsp)> 0)
{
image_speed = 1;
sprite_index = Jacklynn_Falling_BARE;
}
else
{
sprite_index = Jacklynn_Jumping_BARE;
image_index = 0;
}
}
else
{
if (place_meeting(x, y+1, JURRASIC_GROUND)) or (place_meeting(x, y+1, JURRASIC_GROUND_UP))
{
if (hsp==0)
{
sprite_index = Jacklynn_Standing_BARE;
image_speed = 1;
}
else
{
if (hsp==8)
{
sprite_index = Jacklynn_Skating_BARE;
image_speed = 1;
}
}
}
}
For some odd reason, my character refuses to do her running and idle animations. It could be because of all of the "else" statements, but I have no idea. Also, if this is of any importance, here are the frames for each animation:
Credit for helping me with most of the code goes to Shaun Spalding!
Anyways, I want my sprite to have a jumping animation and a falling animation. However, both of the sprites are separate (one falling, one jumping). The falling sprite is the only one that has the animation. Besides that, I also added an idle animation and a running animation. I followed a tutorial but unfortunately it didn't explain to me what I should do if I have more than one frame for my sprite.
Here is the line of code that I used:
//Main Animations
if (!place_meeting(x, y+1, JURRASIC_GROUND)) or (!place_meeting(x, y+1, JURRASIC_GROUND_UP))
{
sprite_index = Jacklynn_Jumping_BARE;
if (sign(vsp)> 0)
{
image_speed = 1;
sprite_index = Jacklynn_Falling_BARE;
}
else
{
sprite_index = Jacklynn_Jumping_BARE;
image_index = 0;
}
}
else
{
if (place_meeting(x, y+1, JURRASIC_GROUND)) or (place_meeting(x, y+1, JURRASIC_GROUND_UP))
{
if (hsp==0)
{
sprite_index = Jacklynn_Standing_BARE;
image_speed = 1;
}
else
{
if (hsp==8)
{
sprite_index = Jacklynn_Skating_BARE;
image_speed = 1;
}
}
}
}
For some odd reason, my character refuses to do her running and idle animations. It could be because of all of the "else" statements, but I have no idea. Also, if this is of any importance, here are the frames for each animation:
- Falling animation: 4 Frames
- Jumping animation: 1 Frame
- Idle animation: 8 Frames
- Skating/ Running animation: 10 Frames
- Hurt animation (I may pester this forum about how to do hurting animation later): 1 Frame
Credit for helping me with most of the code goes to Shaun Spalding!
Last edited by a moderator: