how do you use animated sprites?

i am programming some kind of “1942” game…

i’m using an animated gif for my main plane player.

I’m using applets so i can insert an animated gif without problem… This animated sprites is composed by 3 static images.

My question is:
is this the right way to work? should i use the 3 static images and loop them in my .class file or just insert the animated gif?

i hope i made myself clear, my english isn’t that good :-\

You’re using AWT/Swing?

I would recommend looping 3 static images. I remember having issues with AWT and animated .gif files, where they would all flash when there was more than 1 on the screen, unless they all had their own ImageObserver object, or something like that.

Basically, building a small sprite/animation lib to do the simple things you want to do will pay off in the long run. It also lets you do cool things like directly controlling the framerate during debugging of the collision code (and other things) so that you can see everything in slow motion if you need to. Extremely helpful.

i’m using applets… :-[it’s my first game ever :-[

Applets are actually the second hardest Java graphics programming environment (MIDP1.0 is the hardest)
Unless you really want to do Applets in the long run, Id move to writing Java APplications. There is a
lot more you can do from an Application then from an Applet.

About the only reason thse days to write applets is if you absolutely must embed the Java program in an HTML page.
If you dont mind the game popping up in a seperate window from the HTML, you can launch a Java
application from a web page using Java Web Start,

one reason to use applets is that most people have never heard of java webstart and it doesnt help that web browsers dont recognise the files either(well IE and firefox on all machines i use dont), so people are like. what i downloaded a game but it is only 1kb big and it wont let me play it. ;D

It works fine on IE AND firefox on all my machines. WIn32 and Linux. If youve installed a recent JRE then thats not your rpoblem.

Its more likely that your webserver is failing to return thr right mime type. Without that it may not get recognized.

For some reason it works now XD, but for a long peroid of time it didnt.

Incidently, when i had an older versoin of the jdk installed(cant remeber which), i was able to double click on *.jar files and if they contained a class file with a main method they would load that program. When i installed a newer jdk, windows doesnt recognise *.jar files and i can open them any way other than the command line. does anybody know why this is?