Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

So for my intro to java class we need to re create this. http://people.highline.edu/tostrander/142/demo/pacman.htm

We need to use only the Java.awt package so I figure to make the pacman I need to use a GAarc.

GArc Pac = new GArc(0,60, 120, 120, 45, 270);

This makes an open mouth pacman esque guy facing right.

Where do I go form here to animate him? I know how to move him right but what about make him open and close his mouth?

    //Control of Mouth animation    
        if (Pac.getSweepAngle() <= 270)
            sweepAmountPerFrame  = 2;
        else if (Pac.getSweepAngle() >= 360)
            sweepAmountPerFrame  = -2;
        Pac.setSweepAngle(Pac.getSweepAngle() + sweepAmountPerFrame );
share|improve this question
What have you tried? –  Seth Battin Apr 30 '13 at 17:48
I tried drawing multiple GArcs with different sweeps and having it play them but that didn't work at all. I tried to make a loop for the sweep to rise at a set interval but I couldn't figure out how to make it go back and it also didn't look quite right. –  James Apr 30 '13 at 17:51
I would make a two part animation where the first half is coming up and the second half is coming back down. then loop it –  CobaltHex Apr 30 '13 at 17:58
You should add the code you tried to use. If you are able to produce a movement, an associated animation ought to be simple. But if you show your starting point, it's easier to answer by explaining what needs to change. –  Seth Battin Apr 30 '13 at 18:11
+1 @SethBattin We cannot stress enough how important it is to answering accurately that you let us know what you have tried and give as much detail and or example code as you can to show your problem. –  Blue May 1 '13 at 9:12
show 1 more comment

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.