I am making a slapjack game where the deck will need to give to cards to the slapzone every 5 seconds and flip the image for 2 seconds before turning the picture back over. I know i will have to use a thread, but i can't figure out how to say repeat every 5 seconds i know the repeating part will take a for loop though.
Code:
public void run ()
{
Thread thisThread = Thread.currentThread();
while (thisThread == myThread)
{
try
{
for (int i = 0 ; i < numcards ; i++)
{
deck.giveslapZone(slap1);
}
myThread = null; // kills the thread
}
catch (InterruptedException ie)
{
System.out.println(ie.getMessage());
}
}
}