Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (495)
Games in Android Showcase (114)
games submitted by our members
Games in WIP (563)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Games Center / WIP games, tools & toy projects / Re: Renoria - Java MMORPG on: 2013-11-25 22:46:47
Looks fantastic. I can tell that this game has a bright future ahead. Good luck with Alpha and beyond.   Cheesy
2  Java Game APIs & Engines / Java 2D / Re: Sprite Creator (Finished) on: 2013-02-10 18:15:07
Hey this is pretty neat. Good job, and good luck with future updates.
3  Games Center / WIP games, tools & toy projects / Re: Wizards of Yore (second try) on: 2013-02-08 21:45:51
The graphics look very nice, good luck.
4  Games Center / Showcase / Re: Drone Defense on: 2012-10-14 15:10:09
From the first level, for sure.  Pointing
5  Games Center / WIP games, tools & toy projects / Re: Island Forge (single-dev MMORPG) [Kickstarter Update!] on: 2012-09-14 01:25:38
Good to hear. Good luck with your game, I'm really liking your creativity.
6  Games Center / WIP games, tools & toy projects / Re: Island Forge (single-dev MMORPG) [Kickstarter Update!] on: 2012-09-13 13:56:44
I know you have a free trial, but I think your game would get more popular if you had free-to-play with restrictions and an option to buy membership. Up to you, though.
7  Game Development / Articles & tutorials / Robot Tutorial - Make a Simple Auto-Clicker on: 2012-09-13 13:34:35
This is a tutorial on how to use the Robot class in java. In this tutorial we will be making a simple auto-clicker.

The code of the auto-clicker:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
import java.awt.*;
import java.awt.event.*;
import java.io.*;

/**
 * Simple auto-clicker.
 *
 * @author Bradley Carels
 */

public class AutoClicker {

   public static int rate = 0;

   public static void main(String[] args) {
      while (rate == 0) {
         try {
            System.out.println("Speed of the auto-clicker (in miliseconds):");
            BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
            try {
               rate = Integer.parseInt(in.readLine());
               if (rate < 500) {
                  rate = 0;
                  System.out.println("Must be at least 500 miliseconds.");
               }
            } catch (NumberFormatException ex) {
               System.out.println("Error - please try again.");
            }
         } catch (IOException e) {}
      }
      try {
         Robot robot = new Robot();
         while (true) {
            try {
               Thread.sleep(rate);
               robot.mousePress(InputEvent.BUTTON1_MASK);
               robot.mouseRelease(InputEvent.BUTTON1_MASK);
            } catch (InterruptedException ex) {}
         }
      } catch (AWTException e) {}
   }

}


Explaned
First, the first portion of the code:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
      while (rate == 0) {
         try {
            System.out.println("Speed of the auto-clicker (in miliseconds):");
            BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
            try {
               rate = Integer.parseInt(in.readLine());
               if (rate < 500) {
                  rate = 0;
                  System.out.println("Must be at least 500 miliseconds.");
               }
            } catch (NumberFormatException ex) {
               System.out.println("Error - please try again.");
            }
         } catch (IOException e) {}
      }


The while statement will keep checking for input until a valid number is entered. The entered value is the rate (in miliseconds) that the auto-clicker will run.

Now, the main code of the auto-clicker:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
      try {
         Robot robot = new Robot();
         while (true) {
            try {
               Thread.sleep(rate);
               robot.mousePress(InputEvent.BUTTON1_MASK);
               robot.mouseRelease(InputEvent.BUTTON1_MASK);
            } catch (InterruptedException ex) {}
         }
      } catch (AWTException e) {}


First, a new robot constructor is created. We then set up a thread that runs at the rate set in the previously shown code. Every tick, the mouse is pressed and then released through our robot constructor.


Hopefully this tutorial has helped you understand how the Robot class works. If you have any questions, feel free to ask.
8  Games Center / Showcase / Re: Hunger Games Board Game v0.2.1 on: 2012-08-05 14:48:46
You definitely need to work on tile art. It's just a color square, nothing to look at. But this is very good for your first game.
9  Games Center / Showcase / Re: MARUTA Remake on: 2012-08-05 14:40:17
Cool game, well done.
10  Games Center / Showcase / Re: Blasted Crates on: 2012-08-04 23:44:38
Really nice job. I lost at this part aswell:
Pages: [1]
 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Dwinin (29 views)
2014-09-12 09:08:26

Norakomi (57 views)
2014-09-10 13:57:51

TehJavaDev (79 views)
2014-09-10 06:39:09

Tekkerue (39 views)
2014-09-09 02:24:56

mitcheeb (58 views)
2014-09-08 06:06:29

BurntPizza (45 views)
2014-09-07 01:13:42

Longarmx (30 views)
2014-09-07 01:12:14

Longarmx (36 views)
2014-09-07 01:11:22

Longarmx (36 views)
2014-09-07 01:10:19

mitcheeb (40 views)
2014-09-04 23:08:59
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!