Hi,
I have a transparent PNG (640x320) file holding all tiles used in my game (each tile is 32x32 and has an id based on the position in the big PNG file.
I load this image into a Image object and then use the following method to draw individual tiles:
public abstract boolean drawImage(Image img, int dx1, int dy1,int dx2,int dy2, int sx1, int sy1, int sx2, int sy2, ImageObserver observer).
But the speed is very low, the frame rate makes it impossible to play. When I change to use the following drawImage variation:
public abstract boolean drawImage(Image img, int dx1, int dy1,int dx2,int dy2, int sx1, int sy1, int sx2, int sy2, Color color, ImageObserver observer).
The speed keeps very good (60 FPS). The problem is that the above drawImage will fill transparent portions of the image with color passed as an argument and I do not want that behaviour because I’m using another image as a background (parallax scrolling).
Do you guys know why there is this diference in speed of these two methods? And do you have a solution to keep the transparency?
Thanks a lot,
L. F. Estivalet