drawImage im 13 plz help
I've searched Google now and all the links are purple.
I'm only 13 so sorry.
Don't understand this part.
boolean Graphics.drawImage(Image img,
int dstx1, int dsty1, int dstx2, int dsty2,
int srcx1, int srcy1, int srcx2, int srcy2,
The overloads for this method are exactly what I need but not sure how to use them.
I want to cut up a sprite sheet to animate. Lots of tutorials online but they all seem to skip over the overload parameters.
Or the code they use as examples is heavily tied to other part of their program.
Playing with the different parameters results in very confusing results of scaling and shifting.
I have a sprite sheet about 64x16. This divides into 4 squares 16 in height.
I don't need to know how to make the frames etc, animation etc.
Just how to crop a 16x16 image from that sprite sheet and draw it.
You're barking up the wrong tree :) Check out BufferedImage.getSubimage(...).
That worked perfect!
Is this the fastest way to render cropped images from a sprite sheet?
Also what are accelerated images?
This helped me allot by the way! :):):)
13 huh? Good for you, I didn't start programming until college. I have a feeling you'll go far in life :D
Accelerated images can use your graphics card for hardware accelerated drawing... (if your JRE supports it). Sadly, this is pretty much only true in windows.
Being a Mac user, I have since turned to other means of cross platform hardware acceleration in java - JOGL and more recently LWJGL. Both provide OpenGL mappings for java - LWJGL even adds OpenAL for audio, and some other nifty things (OpenCL).
I would stay away from those things for now, but write them down somewhere, and do a little research once you feel you've hit the limits of Java2D. For many many applications (games, simple animations, etc...) java2D is just fine!