Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (528)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (594)
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 ... 10
1  Game Development / Shared Code / Re: 2D Map editor on: 2013-01-20 14:12:52
I know this is not Java, but i've produced a simple HTML5 canvas renderer for the maps.

http://dl.dropbox.com/u/20470251/03_tilemap/index.html

It's a very simple Canvas implementation. Although the java map editor does not output JSON, it was simple enough to convert a map using find/replace.
2  Games Center / Featured Games / Re: Minecraft on: 2010-10-01 11:01:42
This game is awesome. Can't wait for survival multiplayer. and then the mods when the source is finally released.



That "Cubelands" game is an obvious Minecraft duplication, with just a different name.

You could call minecraft a rip-off of ininiminer too, couldn't you... you could also call Call of Duty a Doom rip-off.
3  Java Game APIs & Engines / Java 2D / Re: Alpha / Additive blending with Composide and Graphics2D on: 2010-06-05 10:22:46
It is quite possible, but i dont think it'd be accellerated.

This post got me interested, and i hacked up a bit of a test.
It's not very fast, and I just guessed the math, so can't guarantee that it's fully correct.

AdditiveComposite.java:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
import java.awt.*;
import java.awt.image.*;
public class AdditiveComposite implements Composite
{
  public AdditiveComposite()
  {
    super();
  }
  public CompositeContext createContext(ColorModel srcColorModel, ColorModel dstColorModel, RenderingHints hints)
  {
    return new AdditiveCompositeContext();
  }
}


AdditiveCompositeContext.java:
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  
43  
import java.awt.*;
import java.awt.image.*;

public class AdditiveCompositeContext implements CompositeContext
{
  public AdditiveCompositeContext(){};
  public void compose(Raster src, Raster dstIn, WritableRaster dstOut)
  {
    int w1    = src.getWidth();
    int h1    = src.getHeight();
    int chan1 = src.getNumBands();
    int w2    = dstIn.getWidth();
    int h2    = dstIn.getHeight();
    int chan2 = dstIn.getNumBands();
   
    int minw  = Math.min(w1, w2);
    int minh  = Math.min(h1, h2);
    int minCh = Math.min(chan1, chan2);
   
    //This bit is horribly inefficient,
    //getting individual pixels rather than all at once.
    for(int x = 0; x < dstIn.getWidth(); x++) {
      for(int y = 0; y < dstIn.getHeight(); y++) {
        float[] pxSrc = null;
        pxSrc = src.getPixel(x, y, pxSrc);
        float[] pxDst = null;
        pxDst = dstIn.getPixel(x, y, pxDst);
       
        float alpha = 255;
        if(pxSrc.length > 3) {
          alpha = pxSrc[3];
        }
       
        for(int i = 0; i < 3 && i < minCh; i++) {
          pxDst[i] = Math.min(255, (pxSrc[i] * (alpha / 255)) + (pxDst[i]));
          dstOut.setPixel(x, y, pxDst);
        }
      }
    }
  }
 
  public void dispose(){}
}



Prog.java sets up a simple JFrame with a custom JPanel that draws wandering spotlights:
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  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
import java.awt.*;
import javax.swing.*;
import java.awt.image.*;

public class Prog
{
  public static void main(String[] a) {
    JFrame frame = new JFrame();
    MyPanel cp = new MyPanel();
   
    frame.setContentPane(cp);
    frame.setSize(400, 400);
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   
    while(true) {
      cp.moveSpots();
      frame.repaint();
      try {
        Thread.sleep(50);
      } catch(Exception e) {
        break;
      }
    }
  }
}

class Spotlight {
  float x, y, vx, vy;
  int w, h;
  Color c;
 
  static Composite acomp = new AdditiveComposite();
 
  public Spotlight(Color colour, int xStart, int yStart, int width, int height)
  {
    c = colour;
    x = xStart;
    y = yStart;
    w = width;
    h = height;
  }
 
  public void paint(Graphics2D g) {
    Composite oldComp = g.getComposite();
    g.setComposite(acomp);   //comment out this line to see the difference
    g.setColor(c);
    g.fillOval((int)x+0, (int)y+0, w-10, h-10);
  }
 
  public void moveRandom(int minX, int minY, int maxX, int maxY) {
   
    vx += 8 * (Math.random() * 0.2 - 0.1);
    vy += 8 * (Math.random() * 0.2 - 0.1);
   
    vx *= 0.98;
    vy *= 0.98;
   
    if(x > maxX - w) {
      vx = vx < 0 ? vx : -vx;
    }
    if(x < minX) {
      vx = vx > 0 ? vx : -vx;
    }
    if(y > maxY - h) {
      vy = vy < 0 ? vy : -vy;
    }
    if(y < minY) {
      vy = vy > 0 ? vy : -vy;
    }
   
    x += vx;
    y += vy;
   
  }
}

class MyPanel extends JPanel {
  Spotlight[] spots = null;
 
  public MyPanel() {
    spots = new Spotlight[6];
    spots[0] = new Spotlight(new Color(255, 0, 0, 128), 200, 0,   200, 200);
    spots[1] = new Spotlight(new Color(0, 255, 0, 128), 100, 200, 200, 200);
    spots[2] = new Spotlight(new Color(0, 0, 255, 128), 0,   0,   200, 200);
    spots[3] = new Spotlight(new Color(255, 0, 0, 128), 200, 0,   200, 200);
    spots[4] = new Spotlight(new Color(0, 255, 0, 128), 100, 200, 200, 200);
    spots[5] = new Spotlight(new Color(0, 0, 255, 128), 0,   0,   200, 200);
  }
 
  public void moveSpots() {
    if(spots == null) return;
    for(int i = 0; i < 6; i++) {
      if(spots[i] != null) {
        spots[i].moveRandom(0, 0, this.getWidth(), this.getHeight());
      } else {
        break;
      }
    }
  }
 
  public void paintComponent(Graphics g) {
    super.paintComponent(g);
    Graphics2D g2 = (Graphics2D)g;
   
    g.setColor(Color.black);
    g.fillRect(0, 0, this.getWidth(), this.getHeight());
   
    for(int i = 0; i < 6; i++) {
      if(spots[i] != null) {
        spots[i].paint(g2);
      } else {
        break;
      }
    }
  }
}


The graphics code seems pretty smart about providing the compose() function with only the area of interest, so i think if you use it for limited small effects, it might run OK.

I noticed that my compose() function was being given 64x64 tiles, rather than all the image at once. There's mention in the API of multithreading, but the result doesn't appear to use it.


Digging down into the java source code, i found their alphacomposite creates BufferedImages from the rasters, then calls a native function called Blit. I didn't look deeper than a quick glance at that file, didn't really understand it. There seems to be a ton of boilerplate in Java.
4  Game Development / Newbie & Debugging Questions / Re: 2 Axises 1 Degree? on: 2010-05-01 10:07:15
Also

C2 = A2 + B2

Gives you how far the stick is tilted in its current direction.

dist = sqrt(axisx * axisx) + (axisy * axisy)

See, high school math is useful in the real world...
5  Game Development / Shared Code / Re: 2D Map editor on: 2010-02-10 11:15:12
for trees, a small block for collision at the base of the tree with the rest of it being walkable should work.

To make a sprite render correctly and go behind stuff, I would render all of the bottom layer first, then the middle layer, row by row, but at the end of each row on the middle layer, also render all the sprites that are standing on that row. This way, when you render the next few rows down, all tall things that stick up will be drawn over the top of that sprite. Finally, render the top layer which has things that are floating and should always go above the sprite.

The trick i used was to place the origin somewhere on the bottom edge of the tile instead of the top, so that tall tiles stick up, and therefore go in front of tiles on the row above them, rather than sticking down and going behind the tiles on the next row.

It's not perfect. if you have a tree with overhanging low branches, you might want to break those branches into separate tiles and put them on the top layer so that you never appear to walk in front of them.

Don't be afraid to use nice big transparent images. you don't have to have a picture in every tile on the grid.
6  Game Development / Shared Code / Re: 2D Map editor on: 2009-11-29 08:35:59
It's a good idea and I've thought of having a mass tile stamp a few times before.

An alternative that would probably work is to use the top layer to paint walkable / unwalkable tiles - you could use semitransparent green and red boxes, and just not render that layer in your game, but use it for collision detection. This would save you splitting up tiles (which is kind of pointless if you'll never use them individually - we're not in the hardware-restricted NES days anymore), but it would use up a layer (feel free to edit the code to allow more layers - shouldn't be too hard).
7  Java Game APIs & Engines / Java 2D / Re: Best way to load / Use sprites on: 2009-10-30 08:01:00
I do it by turning on the grid in my graphics editing program.

or saving each frame to its own file.

Pixel alignment isn't that tedious is it?
8  Game Development / Shared Code / Re: 2D Map editor on: 2009-08-26 08:36:39
How do I run this ? Thanks.

you download the JAR file from http://juddman.googlepages.com/ and then double click it.

If some program stole your .jar file extension (older versions of WinRAR do this) then you can right click the downloaded file, choose open with, and pick Java (you can also pick 'choose program' to permanently change which one opens those kind of files)

If you want some tiles, the source, or some sample maps, then all you need to do is unzip the JAR file using WinRAR or Winzip. it's all in there. to run it once unzipped, there's a file named 'run.bat' that you can double click

If you want to edit the code, you can compile it just by using javac, or by double-clicking make.bat. This will also make a new JAR file with everything packed up for you.
9  Games Center / WIP games, tools & toy projects / Re: LWJGL water shader demo. on: 2009-08-14 12:38:08
2200FPS on ATI HD4850 (CPU is AMD 4600+, windows xp)
10  Game Development / Shared Code / Re: how many lines? on: 2009-08-12 10:15:07
What really matters is if the game is fun Smiley

Quoted for truth.

JMTetris: 3596 (100%)
2D tile map editor: ~3500 (??%)

By the way jezek2, is that FPS a commercial project?
11  Java Game APIs & Engines / Java 2D / Re: Low-hanging graphics programming fruits? on: 2009-07-07 08:16:18
That worked. Thanks.

http://www.juddman.com.au/java/Particle2.jar

You can do a good impression of the smoke-monster from Lost with this one Smiley

Any idea if additive blending is possible?
12  Java Game APIs & Engines / Java 2D / Re: Low-hanging graphics programming fruits? on: 2009-07-07 05:37:21
2 runs very slowly on my Linux box, 3 runs pretty smooth.

no idea at all why i put a 4 there. must have been a typo or a forgotten change i was playing around with.
From what i can see, it really doesn't like graphics that are both translucent and rotated. one or the other is fine, but both bogs it down. i will change it and see how it affects it... 3 vs 4 Seems to make no difference on Linux, but this JVM is 1.6.0_07 so probably has HW accelleration off by default.
13  Java Game APIs & Engines / Java 2D / Re: Low-hanging graphics programming fruits? on: 2009-07-06 04:28:31
Those examples are pretty cool.

A particle system is reasonably easy, make a particle class that stores velocity and position in X and Y, provide a simple update() method that applies the motion and gravity etc. Provide a paint() method that draws the particle... in the simplest case, a particle uses just a single image. With the standard java Image / Swing libraries, you can load up a semitransparent PNG if you want to make smoke, and you can use rendering hints to adjust transparency (eg. to make it fade away at the top). one picture, but a nice fluid effect.

Some code to spawn many of these, add them to a list as you create them, remove them from the list as they die.

I will post some example code when i get a chance.

Edit: Here you go:

http://www.juddman.com.au/java/Particle.jar

It's nowhere near as flashy as the above, but it's using nothing but java libraries.
Unzip it to get source the code.

Java2D has good performance since JRE1.6.0_10. Not as great as those dedicated libraries, but translucent stuff pushes it the most, and it does ok with that as you should see from the example. (actually, when they're rotated it gets a bit chunky)


- Judd
14  Games Center / Showcase / Re: Fish game on: 2009-06-30 09:16:57
Lots of fun. i suggest having some of the fish try to avoid you when you're big, particularly the high scoring ones.
15  Games Center / Archived Projects / Re: JMTetris 2.0 - Webstart on: 2009-06-30 08:38:33
It does write some stuff to the console but not in french.
It could possibly be something from the JInput library, but i'm not sure. can you paste the message?

Edit:

I got back to tinkering with this now, so here's the first new version in 3-4 years. Smiley

Added some basic particle effects. when lines are destroyed, the blocks will explode out of the line, and the blocks above will slide down in to place.

New secret features:
F11: Adjust particle style:
1 time: disables particles
2 times: enables blocks and confetti
6 times: enables excessive amounts of blocks and confetti (will be hard to see what you're doing)
7 times: confetti but no blocks.
8 times: back to start (blocks, no confetti).
3, 4, 5: blocks with varying amounts of confetti.

F12: Increases the speed of the visual effect where blocks above destroyed lines slide down into place.
There are four speeds: slow, medium, fast, and instant.



Enjoy. I'm open to feature requests.
16  Games Center / Archived Projects / Re: JMTetris 2.0 - Webstart, JInput, Force Feedback on: 2009-06-29 14:48:00
Page moved.  My old ISP finally did a tidy up of their member pages, so my files there are all gone now, so i uploaded them elsewhere.
I'm not sure if the old JInput library packaged with it still works on Java 1.6... <a href="http://www.java-gaming.org/topics/a-working-jinput-game/2337/msg/23232/view.html#msg23232">(but not to worry)</a>. Last i checked JInput has changed a fair bit so I doubt it'd be a simple swap out.

Ah those were the days. This is the first game I finished making, back when i was new to programming.
While i'm posting in this ancient thread, I'd like to thank everyone who helped me here when i was starting, many of you are still around.
17  Game Development / Shared Code / Re: 2D Map editor on: 2009-02-07 15:08:09
I've been looking into PNG and metadata recently.

What i'd like to do is make the GraphicsBank sets saveable as a single PNG image of all the tiles, with metadata describing the position and size of each tile in the set. I think i can do this by creating a tEXTEntry node with the info needed.

As well as this, maps could be saved as a thumbnail image with the metadata containing the map itself (which should be easy, since it's already just text).

I'd actually like to be able to optionally store the tiles themselves in the map image somehow, but haven't figured out how i'd go about writing a binary chunk into the PNG metadata (ie the way Fireworks stores layers). custom chunks don't seem supported by Java.

Does anyone know if what i am thinking of can be done with the standard API?

There are two advantages of this approach:

1. Maps get a thumbnail in almost all file explorers
2. Tilesets are just one self-contained file, rather than a text and a bunch of image files.

and if i could store binary as metadata then
3. Map and tileset could be combined for easy transfer when convenience is more important than size.
18  Game Development / Shared Code / Re: 2D Map editor on: 2009-01-18 07:53:51
cool, downloading now...

Interesting. very different. It looks like you based it off version 0.8.
Different grid sizes per layer, a height map, and sprites

I had a go at the game too but my guy died on the first enemy i attacked. Smiley
You could probably save some space by not including all the tiles you dont use
19  Game Development / Shared Code / Re: 2D Map editor on: 2009-01-18 07:47:28
mcco0055: OK, i sent you an email.

I've made a couple of small fixes and uploaded a new version, It's a JAR file, so should be easier to get going than before. the tile images are in the jar file and will have to be extracted if you want to use them.

<a href="http://juddman.googlepages.com/Mapedit-1.01.jar">Mapedit-1.01.jar</a>
20  Java Game APIs & Engines / Java 2D / Re: Multiple "textures" on one scene on: 2008-11-21 10:58:03
Fireworks supports layers and its native format is PNG, although that may be done with metadata trickery
21  Java Game APIs & Engines / Java 2D / Re: Multiple "textures" on one scene on: 2008-11-12 11:34:02
You can represent many values with an RGB image... just adjust the intensity. ie. include dark red, black, white, etc. any number of colours.

Or am i missing something here...
22  Game Development / Shared Code / Re: Distributing a library on: 2008-11-10 10:00:32
Using the latest JVM, the hardware accelleration seems to be on my default. It makes a huge difference.
23  Discussions / General Discussions / Re: "Sun Endorsed" extensions on: 2008-10-26 11:51:12
Java has never crashed my windows system with a BSOD.

Jogl has, on several occasions. Not due to malicious intent by the program using it, just buggy code that did something i'm sure JOGL wasn't expecting.

If it werent for that, i'd be strongly in favor of some of the more standard add-ons to be automtically accepted.
24  Games Center / Showcase / Re: ColourSpace - A schematic texture generator. on: 2008-10-22 23:12:44
This is really good so far, very easy and fun to play with.
25  Game Development / Shared Code / Re: 2D Map editor on: 2008-08-14 13:00:04
By the way, resizing the map and shifting the tiles using the arrow buttons on the toolbars can't be undone. Just thought i'd give you the heads up.

I have recently pushed a very small change to the SVN version, it just fixes a little UI annoyance related to clicking the tile chooser buttons sometimes not registering properly, and an issue where the tiles 'type' would be set to its 'user text', and the user text would be null, losing the type string completely.

the svn is here:
svn checkout http://simple-map-editor.googlecode.com/svn/trunk/ simple-map-editor-read-only

The project page is here:
http://code.google.com/p/simple-map-editor/source/browse/

The files that have changed are:
TileChooser.java
GraphicsBank.java
MapEdit.java
Tile.java
gfx/outdoors.sat


And since it's not on this page of the thread, i might as well chuck the home page URL:
http://juddman.googlepages.com/

I am quite happy with it for the moment and don't have anything on the todo list. Suggestions always welcome, but modified code is even better. If anyone would like to contribute something, i can add you as a project member to the google code project.

Edit: Something i have noticed is with the latest JVM, OpenGL accelleration is enabled by default, and it makes the editor really smooth, even when maximised on a large map and using a lot of alpha blended decorations like that huge shadow image. Well worth the update.
26  Java Game APIs & Engines / Java 2D / Re: get rgb from a canvas? on: 2008-08-14 12:42:15
A Java Canvas is just a place on the screen to display graphics, but it never remembers those graphics, so for example, if you painted something onto it, and then drag another window over it, it would be wiped clean until the next time you paint onto it (either by its overridden paintComponent, or by the BufferStrategy). The canvas can never give you the graphics that are displayed on it.


I don't think you are overriding the paint method as you say you are. that's not how a bufferstrategy works.

Because you are using a BufferStrategy insted of overriding the canvas paintComponent() method, if you want to get what your canvas is displaying into an image, you have to do the same rendering to the image graphics as you do to the BufferStragegy graphics.


In this example, where a simple rendering loop is used:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
private void renderLoop() {
   while(running) {
         do {
            do {
               Graphics2D g = (Graphics2D)bufferStrategy.getDrawGraphics();
               g.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
               g.setColor(Color.white);
               g.fillRect(0, 0, canvasWidth, canvasHeight);
               g.drawImage(image1, 0, 0, null);
               g.drawImage(image2, 30, 50, null);
               g.dispose();
            } while (bufferStrategy.contentsRestored());
            bufferStrategy.show();
         } while(bufferStrategy.contentsLost());
   }
}



If you want to be able to render it onto an image whenever you like, you could replace it with:


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  
private void renderLoop() {
   while(running) {
         do {
            do {
               Graphics2D g = (Graphics2D)bufferStrategy.getDrawGraphics();
               renderSingleFrame(g);
               g.dispose();
            } while (bufferStrategy.contentsRestored());
            bufferStrategy.show();
         } while(bufferStrategy.contentsLost());
   }
}

private void takeScreenShot(BufferedImage into) {
   Graphics2D g = (Graphics2D)into.getGraphics();
   renderSingleFrame(g);
   g.dispose();
}
private void renderSingleFrame(Graphics2D g) {
   g.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
   g.setColor(Color.white);
   g.fillRect(0, 0, canvasWidth, canvasHeight);
   g.drawImage(image1, 0, 0, null);
   g.drawImage(image2, 30, 50, null);
}

27  Game Development / Shared Code / Re: 2D Map editor on: 2008-06-26 14:11:34
Version 1.0

- Right click tiles for a properties dialog to edit their info or delete them.
- Add new tiles by dragging and dropping images onto the tile chooser panel.
- Save and load tilesets independently from maps.

If you remove a tile from a tileset then open a map that referenced it, i think it will be erased (set to 0), but i haven't checked.
Screenshots and download: http://juddman.googlepages.com/ (<a href="http://juddman.googlepages.com/Mapedit-1.0.zip">Mapedit-1.0.zip</a>)

To run it, download the zip, extract, run make.bat, then double click mapedit.jar (or run.bat)
Linux users may prefer to type "javac *.java" and then "java MapEdit"

Open a tileset by clicking the little open button at the bottom of the tile chooser (it's a bad location, i know), and enjoy painting Smiley
or open MyScene.dat for a look at a small map i already made.

If you prefer, drag your own images onto the tile chooser to make new tiles. They can be added to existing tilesets or new ones.

It's been tested but not extensively. tilesets are not compatible with previous versions, though you could create a new one with the same ID numbers for the same tiles, and it should work with existing maps. not sure.

TODO: Allow user to adjust grid width and height.

Edit: oops, forgot to remove that "tileset" button on the toolbar. it's a placeholder and does nothing.
28  Game Development / Shared Code / Re: 2D Map editor on: 2008-06-08 03:33:12
save it to the tilemaps working directory

i hadn't thought of that, and it's a good idea.
I think what i'll do is have the program attempt the path clipping thing on the filename first. If it doesnt match (ie. tile above path of tileset, tile on a different partition... tile on your desktop), then i will copy the image file to the tile directory, otherwise i'll just put the clipped path into the tile list...

EDIT:
I have done a complete rewrite of the GraphicsBank (the class that loads / saves tilesets). It has been simplified. Here's an example of the new tileset format:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
# This file lists all tile resources
# Whitespace at the start of a line, and immediately before and
# after a comma are ignored. Don't use commas in the description.
# Each tile must be on its own line.

ID number,Image file,name,type,Other info...

26, tiles/grass.gif, Green Grass,  No type,   You walk on it...,
1 , tiles/dirt.gif,  Dirt,         No type,   It makes boots muddy,
2 , tiles/tree.gif,  Plain Tree,   no type,   It is a bit wooden,


I think it's both easier to read, and easier to parse, you only need do readLine(), split(",") and trim() to get values.

All paths used to find files are now relative to the file that's referencing them, rather than the location you started the editor from. The editor can no longer read tiles / tilesets inside its own JAR, so will launch with a clean slate instead (but this seems broken right now).

Currently it's not finished so i won't put a new set of files onto the webpage, but if you're curious to take a peek, you can see the SVN here: http://code.google.com/p/simple-map-editor/source/checkout


New properties dialog (left) and some new decoration (right). I decided to stop caring about rendering speed, so any new decorations will be in png with alpha transparency.
<a href="http://juddman.googlepages.com/ver1alpha2.png"><img src="http://juddman.googlepages.com/ver1alpha.png/ver1alpha-medium.png"></a>
29  Game Development / Shared Code / Re: 2D Map editor on: 2008-06-07 14:52:55
Dropping an image onto the tile chooser now adds it as a usable tile, but there's one problem still.

Drag and drop gives me the files i drop as File objects with absolute paths like so:

"C:\Documents and Settings\Judd\Desktop\Judd's Junk\Java\mapedit\gfx\tiles\fence.gif"

But to add them to the tileset, I just want the path relative to wherever you're running the editor from, or wherever the tileset file is located. such as:
"gfx\tiles\fence.gif"



I can think of one quick and dirty way to get this... make a new file at the location of the tileset file, then call getAbsolutePath() on it, make it a string, and clip the beginning of that from the beginning of the other string.

This seems a bit messy to me. Is there another way to do this more reliably?
30  Game Development / Shared Code / Re: 2D Map editor on: 2008-05-19 13:46:25
change
   int tileWidth = 32;
to
   int tileWidth = 50;

and lines 54 & 55 to:
1  
2  
         Image i2 = new BufferedImage(50,100, BufferedImage.TYPE_INT_ARGB);
         i2.getGraphics().drawImage(i, 0, 0, 50,100, null);


Or if your base tiles, ie. the ground ones are 50x50, then use 50, 50.


i have to redo the tileset stuff properly one day. i have been playing around with drag n drop, i wanted to make it so you could create your tileset by just draging images onto the tilechooser panel and then it would ask you for a bit of info about it and add it for you. but first need to add a save function to the GraphicsBank class, which holds a tileset. Actually, it might not be all that much work.
Pages: [1] 2 3 ... 10
 

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

The first screenshot will be displayed as a thumbnail.

PocketCrafter7 (14 views)
2014-11-28 16:25:35

PocketCrafter7 (10 views)
2014-11-28 16:25:09

PocketCrafter7 (11 views)
2014-11-28 16:24:29

toopeicgaming1999 (76 views)
2014-11-26 15:22:04

toopeicgaming1999 (67 views)
2014-11-26 15:20:36

toopeicgaming1999 (17 views)
2014-11-26 15:20:08

SHC (30 views)
2014-11-25 12:00:59

SHC (28 views)
2014-11-25 11:53:45

Norakomi (32 views)
2014-11-25 11:26:43

Gibbo3771 (28 views)
2014-11-24 19:59:16
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

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
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!