Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (416)
games submitted by our members
Games in WIP (306)
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  Java Game APIs & Engines / Java 2D / Re: Sprite Creator (Finished) on: 2013-02-10 19:15:07
Hey this is pretty neat. Good job, and good luck with future updates.
2  Games Center / WIP games, tools & toy projects / Re: Wizards of Yore (second try) on: 2013-02-08 22:45:51
The graphics look very nice, good luck.
3  Games Center / Showcase / Re: Drone Defense on: 2012-10-14 17:10:09
From the first level, for sure.  Pointing
4  Games Center / WIP games, tools & toy projects / Re: Island Forge (single-dev MMORPG) [Kickstarter Update!] on: 2012-09-14 03:25:38
Good to hear. Good luck with your game, I'm really liking your creativity.
5  Games Center / WIP games, tools & toy projects / Re: Island Forge (single-dev MMORPG) [Kickstarter Update!] on: 2012-09-13 15: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.
6  Game Development / Articles & tutorials / Robot Tutorial - Make a Simple Auto-Clicker on: 2012-09-13 15: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.
7  Games Center / Showcase / Re: [WIP] Hunger Games Board Game v0.2.1 on: 2012-08-05 16: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.
8  Games Center / Showcase / Re: MARUTA Remake on: 2012-08-05 16:40:17
Cool game, well done.
9  Games Center / Showcase / Re: Blasted Crates on: 2012-08-05 01:44:38
Really nice job. I lost at this part aswell:
Pages: [1]
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Get high quality music tracks for your game!

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

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
HeroesGraveDev (42 views)
2013-06-15 23:35:23

Vermeer (51 views)
2013-06-14 20:08:06

davedes (48 views)
2013-06-14 16:03:55

alaslipknot (44 views)
2013-06-13 07:56:31

Roquen (62 views)
2013-06-12 04:12:32

alaslipknot (50 views)
2013-06-10 19:30:18

HeroesGraveDev (67 views)
2013-06-09 04:36:03

alaslipknot (54 views)
2013-06-09 03:40:19

CodeHead (54 views)
2013-06-09 02:55:41

GabrielBailey74 (66 views)
2013-06-09 00:02:25
Smoothing Algorithm Question
by UprightPath
2013-05-28 02:58:26

Smoothing Algorithm Question
by UprightPath
2013-05-28 02:57:33

Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38
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!