File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes warhammer 40k game(some bartender please move this to game forum) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "warhammer 40k game(some bartender please move this to game forum)" Watch "warhammer 40k game(some bartender please move this to game forum)" New topic
Author

warhammer 40k game(some bartender please move this to game forum)

Frank McDeffer
Greenhorn

Joined: Jun 04, 2007
Posts: 5
hi, im making a very simple game based on the tabletop game Warhammer 40k
this is my first java project and im starting very simple, a basic menu and a bckground with moveable images, ill add functionality later, anyways, i have read most of java head on(great book by the way) and know how to display bitmaps and a gui, but i dont know anything much beyond that, so what i want to do is when the user clicks a button on the gui, when they move their mouse onto the playing area, the selcted bitmap jumps to the mouse and follows it around the playing area till the user clicks, if anyone could give me some sample code or even just explain it to me, that would be great!

__________________________________________________________________________
|!!!|
|!!!|
|!!!playing area!!!|
|!!!|
|!!!|
|!!!|
|!!!|
|!!!|
|!!!|
|!!!|
|!!!|
|_________________________________________________________________________|
|***************************GUI***********************************|
|_________________________________________________________________________|

sorry i just cant get this text representation to turn out right, it supposed to be a square playing area above a rectangular gui
[ August 24, 2007: Message edited by: Frank McDeffer ]

dont blame me when robots attack! I only made the software...
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

"CPPguy,"

Please check your private messages by clicking on the "My Profile" link near the top of the page. Thanks!


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
Frank McDeffer
Greenhorn

Joined: Jun 04, 2007
Posts: 5
sorry about that, anyways any reply would be greatly appreciated, and if you'd like more information on the game send me a private message, however i doubt if a very good version would be available soon, unlees the community REALLY comes through for me with answers
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Thanks for updating your display name!

I think this question would get more expert advice in our Swing/AWT forum. I'll move it there for you. (Follow link at the top of the page.)
Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
There are a lot of ways to put these kind of things together.
Here's an idea to help you get started.

edit: changed constructor name to properly match class name - sorry.
[ August 24, 2007: Message edited by: Craig Wood ]
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10519
    
    9

Have you considered creating your own cursor from the bitmap? That approach would be easier as compared to the paint efforts involved in moving the bitmap.
Do take a look at Toolkit.createCustomCursor()


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Frank McDeffer
Greenhorn

Joined: Jun 04, 2007
Posts: 5
thanks for the replies, and the game is sort of an rts game so i dont think custom cursors would work,and thanks for moving my post marc, definitely more help here.
Frank McDeffer
Greenhorn

Joined: Jun 04, 2007
Posts: 5
thancks for the code craig, but im a little confused on how to implement it, heres the code i have so far,its just some very simple code for a gui and two images:

[ August 24, 2007: Message edited by: Frank McDeffer ]
Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
Frank McDeffer
Greenhorn

Joined: Jun 04, 2007
Posts: 5
Thank you so much, you're a genious! it works just like i wanted. now i just need to figure out how to make it so that you can select which image you want to move!(also, if i could use this to choose who should shoot that would be great)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: warhammer 40k game(some bartender please move this to game forum)