Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (757)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (844)
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] 2 3 ... 8
1  Games Center / Archived Projects / Re: Wires: rotate the tiles so they are all connected on: 2007-09-03 12:12:32
Well, in my post, don't know if you noticed, it said "for a 6x6" in very small text. That's quite easy to get 74 seconds on a 6x6.
2  Games Center / Archived Projects / Re: Wires: rotate the tiles so they are all connected on: 2007-08-30 12:32:55
74 seconds here... [size=5pt]for a 6x6[/size].
3  Games Center / Archived Projects / Re: Wires: rotate the tiles so they are all connected on: 2007-08-18 16:33:43
Very cool game. Quite addictive.
4  Java Game APIs & Engines / Java 2D / Re: rotating and placing images by points OTHER than their upper left corner on: 2007-08-18 16:01:36
Well, whatever works for you.
5  Java Game APIs & Engines / Java 2D / Re: rotating and placing images by points OTHER than their upper left corner on: 2007-08-18 15:30:28
Okay, that's quite easy to change the position's anchor to the center or any other arbitrary number. To center the image, just subtract half of the image's width from the x-position and half of the height from the y-position. Here's an example:
   public void paint(Graphics g) {
      g.drawImage(img, x-(img.getWidth()/2), y-(img.getHeight()/2), null);

Now to rotate an image, it gets a little more complex. You first need to create a completely empty BufferedImage, with the same width/height of the orignal image and the same transparency (ex. TYPE_INT_ARGB). Then you obtain the Graphics2D object of the empty image by calling createGraphics() on it. You then create an AffineTransform object (located in the java.awt.geom package). Then you call rotate(double, double, double) on your AffineTransform object. The first parameter is your angle to rotate upon, in radians (convert degrees to radians with Math.toRadians(int)). The second parameter is your x-anchor to rotate on. The last parameter is your y-anchor to rotate on. The next step is to call setTransform(AffineTransform) on the Graphics2D object you obtained. The last step is to draw the orignal image onto the empty image at 0,0 (using the Graphics2D again).

Here's the code to rotate:
public BufferedImage rotate(Image source, int angle) {
   int w = source.getWidth(null);
   int h = source.getHeight(null);
   BufferedImage image = new BufferedImage(w, h, source.getTransparency());
   Graphics2D g = image.createGraphics();

   AffineTransform geom = new AffineTransform();
   geom.rotate(Math.toRadians(angle), w/2, h/2);

   g.drawImage(source, 0, 0, null);

   return image;
6  Games Center / 4K Game Competition - 2007 / Re: Time to plan for '08 on: 2007-08-09 11:21:18
Can't we all just, get along?
7  Games Center / 4K Game Competition - 2007 / Re: Time to plan for '08 on: 2007-08-04 13:52:07
Because, as Markus said, this whole competition is turning into a compression-contest, I'd be much happier with a 8K contest, where no compression is allowed at all.

Just distributing a class-file!

I know it's not going to happen. but still... Lips Sealed
I always thought that was the whole point of 4K in the first place...? I never knew any kind of compression was used until I read this thread.
8  Games Center / Archived Projects / Re: Falling Blocks on: 2007-08-02 11:15:27
Hmm, guess I got a lot to learn about Tetris...

Oh by the way, something that's probally useless to say now, I'm gonna say anyway...
I'm having trouble with the "Application's digital sig. can not be verified" (even after using keytool  && jarsigner ).
If you are signing the application yourself, Java won't be able to verify it. If your application is requesting permissions to the system and your application is not signed at all, Java also cannot verify the digital signature (because it has none).
9  Games Center / Archived Projects / Re: Falling Blocks on: 2007-08-02 01:44:01
Thanks.  I'll look into the jnlp permissions.

I agree with you guys, sluggish controls.  I'm struggling with the fact that when you press a key it easily sends 3 or 4 key press events.  If I have each keypress move a block x+1 (or x-1 depending on direction) on the grid... then each press might send the block zipping across the play grid.  To slow this down, I'm using if(blockLoopDelta > blockSpeed){move()}else{blockLoopDelta+=gameDelta} logic to keep the blocks for zipping 3 or 4 units per millisecond.  unfortunately, this requires 3 or 4 key press events to move a block.   Undecided

Any thoughts on how to control how may key press events occur per a users physical press (or how to make the controls react correctly)?.

Lastly, I'll put some collision detection in there for horizontal collisions (clearly, I only have boundary and vertical collision detection).


The best way I found to reduce this problem is to just drop my framerate to about 20 or 25 frames per second.
10  Games Center / Archived Projects / Re: Falling Blocks on: 2007-08-01 11:23:50
Very nice for a Tetris clone. But like what Riven said, moving horizontally allows the block to move through another block. Would like to see a different variation of Tetris though. Such as with power ups or some kind of other wild game play never done before in a Tetris game.
11  Java Game APIs & Engines / Java 2D / Re: draw text to the screen with breaks on: 2007-07-31 11:29:35
Here's a simple method that takes a String-array and draws it at the specified corners.

(I haven't actually tested it yet - not a lot of time at the moment - but it should work with no problem.)
public void drawStrings(Graphics g, String ln[], int x, int y) {
   FontMetrics fm = g.getFontMetrics(g.getFont());
   int h = fm.getHeight();

   for (int i=0; i<ln.length; i++) {
      g.drawString(ln[i], x, y+(h*i));
12  Java Game APIs & Engines / Java 2D / Re: Mirror an Image on: 2007-07-31 11:15:33
No problem.
13  Java Game APIs & Engines / Java 2D / Re: Mirror an Image on: 2007-07-30 11:27:56
g.drawImage(image, x, y, -width, height, null);

-width mirrors it horizontally
-height mirrors is vertically
(or combine both)

Keep note that mirroring an image will reverse the origin (as in, the origin is always top-left. Mirroring left-to-right, your new origin will be drawn from top-right).
14  Games Center / 4K Game Competition - 2007 / Re: 2008 competition? on: 2007-07-25 11:25:06
Actually 5 months till '08, but yeah. I'd love to see another 4K competition next year, as I never got a chance to participate in the last years competition. But I loved playing every one else's game. Maybe next year I can actually have enough time to finish one and submit it.
15  Discussions / General Discussions / Re: Anticipated games from E3 ( NiGHTS! ) on: 2007-07-15 13:04:18
I must say I'm looking forward to (in no particular order) Need for Speed ProStreet, Burnout Paradise, Halo 3, and Grand Theft Auto 4. I'm going to pre-order all four! Grin
16  Java Game APIs & Engines / Java 2D / Re: Help jumping in platformer. on: 2007-07-04 11:31:39
What I do is I have two variables, gravity and speedy. Both values are float. Gravity is usually set between 0 and 1 (usually with two or three decimal values). speedy starts at 0 when the game begins. When your character needs to jump (such as the space key pressed) set your speedy variable to something like -8 (play around with both this and the gravity variable to get the desired effect) and in your game loop, you increment your y-position of your object by adding speedy to it (e.g. object.y += object.speedy;). After that line of code, you increment speedy by adding the gravity variable to it (e.g. object.speedy += object.gravity;). You'll want to limit how high speedy can get (e.g. you don't want it to be 100 or the character will fly through the floor). Usually it should be a no higher than your floor's height divided by 2). I usually use this to limit it:

if (object.speedy > tileH/2) object.speedy = tileH/2;

(After adding the gravity to the speedy!)

Good luck,
17  Game Development / Newbie & Debugging Questions / Re: Drawing brush strokes on: 2007-07-04 11:22:37
Maybe enabling anti-aliasing would smooth it out?
18  Games Center / Showcase / Re: Rescue Squad - In Colour! on: 2007-06-12 03:31:38
Very cool. Ran great. Love the fake-3D (eg not real 3D) copter.
19  Discussions / Miscellaneous Topics / Re: How to build sites with php? on: 2007-06-07 11:15:27
Not really. I used to write very advanced websites with PHP with extreme ease. I did all the coding in Notepad, surprisingly. I wrote a complete forum software like phpBB and sold it for $250 (wasn't quite advanced as phpBB, however). It was a sure nice chunk of change. I also did a lot of backend programming with PHP, such as a CMS (Content Management System). And I obviously couldn't live with having PHP without MySQL.
20  Games Center / Archived Projects / Re: Space Invaders on: 2007-06-05 03:59:24
Okay, so, update! I've been able to successfully place everything (including lwjgl.jar) in separate JAR files. Now supports Windows, Linux, and Mac (so far, only tested on Windows). Another update is it supports controller input (only the first available controller that has at least one axis is selected by default).

Please run it and tell me what you think of it. I'd be interested to see what the results are on Linux and Mac (and other versions of Windows).

EDIT: Oh and by the way, thanks for all the help!!! I really appreciated it!
21  Games Center / Archived Projects / Re: Space Invaders on: 2007-06-04 11:21:12
Okay, thanks for the information. I'll go ahead and sign the JARs myself.
22  Games Center / Archived Projects / Re: Space Invaders on: 2007-06-03 14:30:48
I cannot run the JAR file without it being signed. I get the following:
(this is running from my local server)
Unsigned application requesting unrestricted access to system
Unsigned resource: http://localhost/Java/SpaceInvaders/lwjgl.jar

It will not start up after that, just cancels it out.

And as you said...
the lwjgl jars needs to be signed, because running native code is not allowed per default.
If they DO need to be signed... am I required to sign them myself? If not, where are the signed versions of the JARs???


Launch it now and you'll see the error.
23  Games Center / Archived Projects / Re: Space Invaders on: 2007-06-03 00:04:59
Oh that. I didn't know that was on I intended my game to be like that one, but I found it on kevglass' site, I didn't use the tutorial, but I got the art from, apparently he altered the art a little though.

But anyway, does anybody know why the lwjgl.jar needs to be signed? And where to get the signed jar from (or do I sign it myself?).
24  Games Center / Archived Projects / Re: Space Invaders on: 2007-06-02 20:50:33
No, I am not. What is that? It can't be part of the API, it's not in the API docs. Is it part of a CVS? I don't see any CVS on the website.
25  Games Center / Archived Projects / Space Invaders on: 2007-06-02 18:59:52
Hello all,

I thought I would throw my Space Invaders game your way and see what you guys think of it. It's my first LWJGL game. I cannot find a signed lwjgl.jar file (maybe I'm supposed to sign it myself?), so I had to distribute the files inside the main jar file, so it's Windows only.

Here's a screenshot for those of you who can't run it if they don't have Windows (again, sorry about that).

Here's the WebStart link:
26  Discussions / Miscellaneous Topics / Re: How to build sites with php? on: 2007-06-02 14:37:39
It doesn't matter how you program in PHP... it's still PHP. It will always look the same. I always liked PHP's syntax, but I can't remember much of it as I have not done any in more than 4 years. I used to be a great PHP programmer but I hated general web development (eg using HTML, CSS, layouts, etc). Also, PHP-GTK+ reminds me of Java now that I think of it.
27  Java Game APIs & Engines / OpenGL Development / Re: Good enough texture loader? on: 2007-06-01 22:26:29
Thanks a lot guys. That worked just great.
28  Java Game APIs & Engines / OpenGL Development / Re: Good enough texture loader? on: 2007-05-31 23:53:52
Yeah, sorry. I guess I should have posted a screenshot. Here's the texture:

And here's a screenshot of the LWJGL alpha test I made (multiple sprites moving and rotating):

Click for the full size view.

Notice the kind of "halo" on his head?

EDIT: I found a fix for this. By adding a one pixel border around the sprite, it removes the artifacts. Looks good.
29  Java Game APIs & Engines / OpenGL Development / Good enough texture loader? on: 2007-05-31 11:24:25
Hello all,

I'm wondering if the texture loader I have is good enough for 2D games in LWJGL. It works great with 3D development, but with 2D textures with alpha values, there's small artifacts in the image. What can I do to improve this for 2D games?

I'm converting the image data to bytes myself.

   // Loads a texture.
   public int loadTexture(String filename) {
      int ID = 0;

      try {
         BufferedImage image =;
         int imageW = image.getWidth();
         int imageH = image.getHeight();

         int size = imageW*imageH;
         IntBuffer data = BufferUtils.createIntBuffer(size);
         for (int y=0; y<imageH; y++) {
            for (int x=0; x<imageW; x++) {
               Color c1 = new Color(image.getRGB(x, y), true);
               Color c2 = new Color(c1.getBlue(), c1.getGreen(), c1.getRed(), c1.getAlpha());

         IntBuffer buf = BufferUtils.createIntBuffer(1);
         ID = buf.get(0);
         GL11.glBindTexture(GL11.GL_TEXTURE_2D, ID);

         GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, imageW, imageH, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, data);
         GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
         GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
      } catch(Exception e) {
         Sys.alert("Error", "Unable to load texture: "+filename);

      return ID;

I'm using the following blend function:

30  Java Game APIs & Engines / Java 2D / Re: getting very high FPS with standard Java 2D on: 2007-05-30 11:23:35
If your game is using vertical-sync, you shouldn't have the need to sleep. But if your just using say nanoTime() for limiting your frames per second but your running your render loop (drawing not updating) as often as possible, you'll need to sleep for at least 1 millisecond or else you'll cap the CPU to 100%. If you can find an alternative way to prevent your render loop from running as often as possible (like the technique vertical-sync uses but not being in fullscreen), you won't have a need for sleep also.
Pages: [1] 2 3 ... 8
EgonOlsen (45 views)
2018-06-10 19:43:48

EgonOlsen (25 views)
2018-06-10 19:43:44

EgonOlsen (47 views)
2018-06-10 19:43:20

DesertCoockie (202 views)
2018-05-13 18:23:11

nelsongames (127 views)
2018-04-24 18:15:36

nelsongames (126 views)
2018-04-24 18:14:32

ivj94 (867 views)
2018-03-24 14:47:39

ivj94 (128 views)
2018-03-24 14:46:31

ivj94 (771 views)
2018-03-24 14:43:53

Solater (143 views)
2018-03-17 05:04:08
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05 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‑
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!