• Post Reply Bookmark Topic Watch Topic
  • New Topic

Retrieving tooltiptext from a game....  RSS feed

 
Justin Fox
Ranch Hand
Posts: 802
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have an application where...

the mouse moves around randomly in an 800X600 space.

and everytime it moves, it clicks...

so it moves and clicks every 6 seconds...

and every.... 4 min, it presses F1.


now what i want to do is get the cursor to actually look for an object

by using the tooltiptext above the object to determine rather or not

it should click on it....

any advice, here is my code




appreciate the help,


Justin
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since there seems to be nothing applet-specific in this question, I'm moving it to the GUI/SWT/Swing/AWT forum. Please find it there and continue the discussion.
 
Campbell Ritchie
Sheriff
Posts: 53774
128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So who gave you this assignment?

Can you organise a Rectangle2D to enclose your invisible object? If so, you can probably find a contains method for the mouse location.
 
Justin Fox
Ranch Hand
Posts: 802
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well in the game, there are "RedDevilL117" "monsters"...

and since the game isn't acctually in the JFrame that i wrote...

would that 2D box apply to another window?

just as the clicking and moving does?

is there a way to pick up the name of the monster when the mouse moves

over it?

because if there isn't then ill just trash the project..

Justin
 
Justin Fox
Ranch Hand
Posts: 802
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i think i've got it....

when you call "createScreenCapture(Rectangle screenRect)"

would that give you a picture of the current screen state in the

JPanel/JFrame?

could you set it up to where it does that??

because then i could "freeze" the game state in the application...

and then write code to find the coords of the object in the picture

that i want to click on...

thanks,

Justin
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!