0

I'm making a game and I want show a gif with the stdDraw method but this doesn't work. So if someone can explain me a method to show a gif with stdDraw, this will be cool !

  • Hi @TheProgrammeur! It would be great if you could write us in the question what you tried so far, so that people can help you on your specific issue :) – Jubstuff Dec 01 '18 at 21:42
  • What on earth is `stdDraw`? Which GUI component toolkit is being used (e.g. Swing, AWT, Java-FX..)? For better help sooner, [edit] to add a [MCVE] or [Short, Self Contained, Correct Example](http://www.sscce.org/). – Andrew Thompson Dec 02 '18 at 08:49
  • StdDraw.setCanvasSize(700, 700); StdDraw.enableDoubleBuffering(); StdDraw.picture(0.5, 0.5, "./image/planet.gif"); StdDraw.show(); This doesn't work but if I put a '.jpg' it's good why ? – TheProgrammeur Dec 02 '18 at 22:06
  • @Andrew it's a library developed by Princeton for educational purposes https://introcs.cs.princeton.edu/java/stdlib/javadoc/StdDraw.html – Orion Jan 01 '19 at 18:52
  • *"This doesn't work but .."* Tip: Add @Jubstuff (or whoever, the `@` is important) to *notify* the person of a new comment. – Andrew Thompson Jan 01 '19 at 18:55

1 Answers1

0

All you need to show a gif is a single declaration, where xPos and yPos are image coordinates with respect to lower left corner of window.

StdDraw.picture(xPos,yPos, "image.gif");

I hope you know that default coordinates of the right top corner are (1, 1).

Image should be saved in project's home directory.