1

I'm making a 2D tile based game and I need to make part of a sprite transparent. I assume I should choose a determinate color and tell Java "Please Java, don't draw any pixel of this color.", but I don't know how to do it. I already googled it but I only get results about "alpha".

Also how can I "set priority" to my sprites so that the ones with high priority are always drawn in the front?

Thanks.

Rama
  • 4,697
  • 5
  • 22
  • 19

2 Answers2

3

Use png files for the sprites. Java will draw transparent parts of png files transparently.

As for the sprite ordering, this is difficult to advise without any knowledge of your game's code structure. You could give each sprite a Z-index, sort and draw in order.

Dave
  • 10,964
  • 3
  • 32
  • 54
  • Thanks for you answer :) Luckily I've been using .png images, but how can I draw transparency if I use Paint? Am I bound to use photoshop? – Rama Aug 15 '11 at 04:27
  • 1
    Or, if you want free, The Gimp. I've never messed with transparency in paint. The option should be something blatant, like "color to alpha" – Dave Aug 15 '11 at 04:29
1

This KineticModel creates multiple, translucent instances of GradientImage as part of a simulation.

trashgod
  • 203,806
  • 29
  • 246
  • 1,045