| Rotating Mouse | |
|
|
Author | Message |
---|
b0xb0x Administrator
Posts : 130 Join date : 2011-02-25 Age : 28 Location : California
| Subject: Rotating Mouse Wed Mar 09, 2011 10:09 pm | |
| This method can be used to make a rotating mouse for your script. Imports: - Code:
-
import com.rsbuddy.script.methods.Mouse; import java.awt.*; As a method: - Code:
-
private double getRot(int ticks){ return (System.currentTimeMillis() % (360 * ticks)) / ticks; } In your onRepaint() - Code:
-
Graphics2D g = (Graphics2D) g1; g.drawString("Nonrotating", 0, 0); Graphics2D m = (Graphics2D) g1; m.rotate(Math.toRadians(getRot(5)), Mouse.getLocation().x, Mouse.getLocation().y); // Mouse graphics here Enjoy.
Last edited by b0xb0x on Sun Mar 13, 2011 12:05 pm; edited 3 times in total | |
|
| |
TaffTech Administrator
Posts : 72 Join date : 2011-02-27
| Subject: Re: Rotating Mouse Wed Mar 09, 2011 10:50 pm | |
| That's pretty awesome Would you by any chance know how to make a trailing mouse? Because I'd love one of those for my scripts xD In the meanwhile, I'll be trying to make on of my own | |
|
| |
b0xb0x Administrator
Posts : 130 Join date : 2011-02-25 Age : 28 Location : California
| Subject: Re: Rotating Mouse Wed Mar 09, 2011 10:58 pm | |
| | |
|
| |
TaffTech Administrator
Posts : 72 Join date : 2011-02-27
| Subject: Re: Rotating Mouse Wed Mar 09, 2011 11:02 pm | |
| | |
|
| |
b0xb0x Administrator
Posts : 130 Join date : 2011-02-25 Age : 28 Location : California
| Subject: Re: Rotating Mouse Wed Mar 09, 2011 11:05 pm | |
| - TaffTech wrote:
- Awesome
Never mind those links, none really help haha :P | |
|
| |
b0xb0x Administrator
Posts : 130 Join date : 2011-02-25 Age : 28 Location : California
| Subject: Re: Rotating Mouse Wed Mar 09, 2011 11:12 pm | |
| I'll let you do it haha it's a pain since you have to create x timers running at x different equal times that save the mouse points in an array and then in your Graphics2D, make a for statement that draws the mouse based off of the array of points looping rather than just one point. | |
|
| |
b0xb0x Administrator
Posts : 130 Join date : 2011-02-25 Age : 28 Location : California
| Subject: Re: Rotating Mouse Wed Mar 09, 2011 11:37 pm | |
| | |
|
| |
TaffTech Administrator
Posts : 72 Join date : 2011-02-27
| Subject: Re: Rotating Mouse Wed Mar 09, 2011 11:38 pm | |
| - b0xb0x wrote:
- I'll let you do it haha it's a pain since you have to create x timers running at x different equal times that save the mouse points in an array and then in your Graphics2D, make a for statement that draws the mouse based off of the array of points looping rather than just one point.
My idea was somewhat simpler... xD Have an arraylist of saved points then. Draw a line from the mouse position to the last point, Draw lines from and to each point in the arraylist, Update the points | |
|
| |
Ramus VIP
Posts : 41 Join date : 2011-02-27 Age : 28 Location : Wales
| Subject: Re: Rotating Mouse Sun Mar 13, 2011 12:22 am | |
| It works, but it's a bit laggy when I try to rotate a rectangle :S Any ideas? | |
|
| |
Remo Member
Posts : 41 Join date : 2011-03-10
| Subject: Re: Rotating Mouse Sun Mar 13, 2011 6:26 am | |
| Mouse can not be resolved =[ What is the import I need? | |
|
| |
b0xb0x Administrator
Posts : 130 Join date : 2011-02-25 Age : 28 Location : California
| Subject: Re: Rotating Mouse Sun Mar 13, 2011 8:51 am | |
| - Remo wrote:
- Mouse can not be resolved =[ What is the import I need?
com.rsbuddy.script.methods.Mouse | |
|
| |
Remo Member
Posts : 41 Join date : 2011-03-10
| Subject: Re: Rotating Mouse Sun Mar 13, 2011 10:03 am | |
| - b0xb0x wrote:
- Remo wrote:
- Mouse can not be resolved =[ What is the import I need?
com.rsbuddy.script.methods.Mouse That's what can't be resolved. | |
|
| |
Salvation VIP
Posts : 15 Join date : 2011-02-28
| Subject: Re: Rotating Mouse Sun Apr 03, 2011 9:55 am | |
| - Code:
-
@Override public void onRepaint(Graphics graphics) { Point location = Mouse.getLocation(); Graphics2D m = (Graphics2D) graphics; m.setRenderingHints(antialiasing); m.rotate(Math.toRadians(getRot(5)), location.x, location.y); m.drawImage(mousepointer, location.x, location.y, null); Graphics2D g = (Graphics2D) graphics; g.setRenderingHints(antialiasing); g.setColor(Color.BLACK); g.drawLine(location.x, 0, location.x, (int)Game.getCanvasSize().getHeight()); g.drawLine(0, location.y,(int)Game.getCanvasSize().getWidth(), location.y); g.drawImage(mousepointer, location.x, location.y, null); } no shittin me, the entire thing is turning >.< | |
|
| |
Salvation VIP
Posts : 15 Join date : 2011-02-28
| Subject: Re: Rotating Mouse Sun Apr 03, 2011 10:12 am | |
| fixed, will post later - Code:
-
double rotation = Math.toRadians(System.currentTimeMillis() % (360)); g.rotate(rotation, location.x, location.y); g.drawImage(mousepointer, location.x, location.y, null); g.rotate(-rotation, location.x, location.y); | |
|
| |
Sponsored content
| Subject: Re: Rotating Mouse | |
| |
|
| |
| Rotating Mouse | |
|