| 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: 8546
|
|
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()
|
[Donate a pint, save a life!] [How to ask questions] [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)
|
 |
 |
|
|
subject: warhammer 40k game(some bartender please move this to game forum)
|
|
|