This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Java in General and the fly likes 2D animation/transparency question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "2D animation/transparency question" Watch "2D animation/transparency question" New topic

2D animation/transparency question

Mich Robinson
Ranch Hand

Joined: Jun 28, 2009
Posts: 250
I've just written a simple game of Connect 4 but I can't work out how to make the pieces slide in behind the grid to make things look more real. I currently have the grid displayed on a wooden background which I like and I'd also like the image of the wood to show through the holes in the board. Any ideas?

Obviously I could just display the pieces over the top of the grid but this stops me from being able to animate the sliding of a piece in behind the grid. Not sure if that made sense but here's the game - how do I simulate sliding pieces in at the top? I'm just a bit stuck.

Arcade : Alien Swarm
Board : Chess - Checkers - Connect 4 - Othello
Mich Robinson
Ranch Hand

Joined: Jun 28, 2009
Posts: 250
Solved by using the to generate images with transparent areas. I then just drew the background image first, then drew the pieces on top of that and then finally drew the grid with the transparent areas on the top. It all worked fine.
I agree. Here's the link:
subject: 2D animation/transparency question
Similar Threads
I want to tokenize a String? How do I ignore the spaces?
creation of dynamic chessboard with user interactivity using javascript.
Having problems in unMakeMove() for chess
chess programming