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

An animation stutters.

D

Dawid

Guest
Hi,

I am making a program that makes an animation tree. It plays an initial animation, and chooses a random animation of 2 to play next. For each of these two is randomly chooses a continuation, goes back to the initial animation and so on.The problem is that each of these animations played for the first time stutters. All the assets together are 400MB and run at 30fps . I tried running it in Game Maker, creating a zipped exe file and an installer. The outcome is every time the same. I made only one object with only one 'animation end' event. It uses a series of 'if' statements and changes the 'sprite_index' variable. Is there a way to fix it? Is there a way to make the game load longer, but run smoothly one it loads.

Thank you in advance for help.
 

PlayerOne

Member
Hi,

I am making a program that makes an animation tree. It plays an initial animation, and chooses a random animation of 2 to play next. For each of these two is randomly chooses a continuation, goes back to the initial animation and so on.The problem is that each of these animations played for the first time stutters. All the assets together are 400MB and run at 30fps . I tried running it in Game Maker, creating a zipped exe file and an installer. The outcome is every time the same. I made only one object with only one 'animation end' event. It uses a series of 'if' statements and changes the 'sprite_index' variable. Is there a way to fix it? Is there a way to make the game load longer, but run smoothly one it loads.

Thank you in advance for help.

Please post the relevant code so that we may help you.
 
D

Dawid

Guest
Animation end event:

if score == 0
{
sprite_index = neutral;
score = 1;
exit;
}
else if score == 1
{
randomize();
check = irandom(11);
if check > 5 and check < 9
{
sprite_index = attack1;
score = 2;
exit;
}
else if check > 8
{
sprite_index = alterattack1;
score = 0;
exit;
}
else if check == 0
{
sprite_index = dragonattack1A;
score = 0;
exit;
}
else if check == 1
{
sprite_index = dragonattack1B;
score = 0;
exit;
}
else if check == 2
{
sprite_index = dragonattack2a;
score = 0;
exit;
}
else if check == 3
{
sprite_index = dragonattack2b;
score = 0;
exit;
}
else if check == 4
{
sprite_index = dragonattack3;
score = 0;
exit;
}
else if check == 5
{
sprite_index = dragon_alterattack;
score = 0;
exit;
}
}
else if score == 2
{

check = irandom(2);
if check == 0
{
sprite_index = attack2;
score = 3;
exit;
}
else if check == 1
{
sprite_index = attack1b;
score = 0;
exit;
}
else if check == 2
{
sprite_index = attack1c;
score = 0;
exit;
}
}
else if score == 3
{
check = irandom(2);
if check == 0
{
sprite_index = attack3;
score = 0;
exit;
}
else if check == 1
{
sprite_index = attack2b;
score = 0;
exit;
}
else if check == 2
{
sprite_index = attack2c;
score = 0;
exit;
}
}
 

PlayerOne

Member
A few things:
1) Using exit statements at the end of every if statment isn't needed.
2) This code needs to go in the step event and not the animation end event.
3) If my memory is correct randomize() is only needed to be initalized once and not multiple times. Not 100% since I don't use this.
4) Also why are you using irandom()? Unless you didn't post the full code it doesn't seem like it's needed.
5) Animation end event does what it says on the tin - ends that animation with a action. The problem you are having now could be related to just having this in the animation end event alone.
 
D

Dawid

Guest
What I want is for that program to pick an animation after another animation has ended. I thought that's what this event is for. Not even sure how to do that in a step event.
 

PlayerOne

Member
What I want is for that program to pick an animation after another animation has ended. I thought that's what this event is for. Not even sure how to do that in a step event.
Read the docs to understand what each event does.

I'm not sure how you want to go about this either with a "pool" of animations and have that animation removed once played or just have a different animation play while the previously played animation can be used at a later time.

If you want to choose a random animation use this:

Code:
if (keyboard_check_pressed(vk_space))
{
sprite_index=choose(sprite1,sprite2,sprite3,sprite4,etc);
}
 
Top