Hey, everybody!
I'm having a slight problem using Slick and getting transparent colors working with SpriteSheets and Animations. Here's the code I have to load a SpriteSheet and create two Animations from it in my game engine:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| public void loadCreatureSprites() { SpriteSheet sheet = null; try { sheet = new SpriteSheet("resources/images/playersheet.png", 60, 72, new Color(Vast.COLOR_KEY)); } catch (SlickException ex) { ex.printStackTrace(); } Animation playerAnim1 = new Animation(sheet, 80); Animation playerAnim2 = new Animation(); for (int i = 0; i < playerAnim1.getFrameCount(); i++) { playerAnim2.addFrame(playerAnim1.getImage(i).getFlippedCopy(true, false), 80); }
playerSprite = new Player(playerAnim2, playerAnim1, playerAnim1, playerAnim1); }
|
The Animations load and play when I move about, but the color around the images that I've designated as a key still shows up (it's a bright pink color, whose hex value is defined in a separate class called Vast, hence Vast.COLOR_KEY). I'm not sure if there's something I'm missing here, but I would really like to use Slick's Animations and SpriteSheets rather than having to roll my own because of this color key issue, and if I try and give my .png images their own alpha channels to circumvent the issue, the alpha just loads as black in the game.
Thanks a lot for your help! :]
Colton