Original Post
Hi
I''m programming a RPG battle system and I''m having some problems with the animations.
To avoid using thread.sleep (since that involved repeating the same code many times) I did the following code (example):
aniatt[0] = false;
aniatt[1] = false;
time = 500;
timeset = 500;
if ((aniatt[0] == false) && (aniatt[1] == false))
{
//load image 1
if (time > 0)
{
time--;
}
else
{
aniatt[0] = true;
time = timeset;
}
}
if ((aniatt[0] == true) && (aniatt[1] == false))
{
//load image 1
if (time > 0)
{
time--;
}
else
{
aniatt[1] = true;
time = timeset;
}
}
My problem is, it takes around 1 min and 30 seconds to time var (which starts at 500) to get to 0 which forces me to give it a value o 20.
What do you think? I''m either programming something wrong, it''s slow because I''m programming the game on a p133 or it''s just normal since I have lots of code before this animation loads?
My problem is, if I had a thread sleep in the update() to make sure the game runs just fine in every pc, with the time == 20 it''ll either be just to slow or just to fast:|
Telmo Amaro -- www.codingdreams.xrs.net