Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (109)
games submitted by our members
Games in WIP (536)
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: Need help with yet another tile based map editor! on: 2011-08-22 19:10:24
Your graphics look pretty good. I look forward to seeing the a game demo. Did you break all your sprite elements down to the size of your grid? Or do you all sprites to be a size factor of the grid size. i.e. sprite can take up 2x2 grids?

I'm not sure if I understand your question correctly, but I'll explain how i have implemented it. When you start a new project you can define the size of each tile in pixels. In the code I have left support for two different parameters, one size for the tile set, and one size for the map. But at the moment you can just choose a common size for both of them. I have tested this by hard coding different sizes and my solution for handling the different sizes is to, say that you have chosen 32x32 pixels for each tile from the tile set and the map has tiles of size 50x50. What happens is that the tiles from the tile set are stretched to match the size of the map. Does it make sense? The reason why I haven't added support for this is in the GUI is because i don't know how to handle this when I export the completed level. I will later on add support for placing characters on the map, and they will be separated from the tile system, making it possible for them to have bigger textures separated from the tile system.

I haven't made the tile set myselft, it's just something I got from the Internet, but we have people drawing tiles, so hopefully our finalized products will look good.

Why not use Tiled?
http://www.mapeditor.org/

IIRC, there is even a link to the Java source.
(so you can have a look around at how it handles tile maps)

I'm aware of that. When I started I had no idea of how image manipulation and everything related to level editors works in java. So instead of studying the code and try to understand I thought that in the end I would save time by implementing and learning it all by myself. Now when I have an idea of how this works I'm thinking of starting to contribute to Tiled instead. I've implemented a file-parser for it for one of my projects in C++ and I think that their solution for the exported file looks much better than mine. I did this since they have support for isometric view and it wasn't anything I was planning implement for my own editor.

And it's a bit too late to look at their source of how to handle tiles, since I'm done with my own implementation of it, but I'm sure they're a bit more organized than my negligently implemented MVC-pattern.
2  Java Game APIs & Engines / Java 2D / Re: Sidescroller tile based game on: 2011-08-22 18:23:18
I would do it like you suggested, but instead of filling the two dimensional array with integers, I would fill it with Tile-objects that contain data about texture, position, walkable and so forth. By doing this you can calculate which tiles to draw and which to check collisions on. (Depends on the resolution of the screen, so you have to take that in consideration when you implement the algorithm.)
3  Java Game APIs & Engines / Java 2D / Re: Need help with yet another tile based map editor! on: 2011-08-19 12:02:32
It's been a while since I worked with my editor, but I thought that it would be fun to post a picture of it! As a sign of that your help didn't go to waste!



Feel free to ask any questions if you wonder something Smiley I have implemented save and export functionality, so it's now possible to actually use the editor for any 2D-game!
4  Java Game APIs & Engines / Java 2D / Re: Need help with yet another tile based map editor! on: 2011-07-11 21:55:20
I have made a lot of progress with my level editor. I started by extending JPanel and writing my on paintComponent method. When the MouseListener detects a button click, the logic counts where to draw the tile. In the background I have a Tile[][] matrix that contains data about every tile that has been added. This way it was easy for me to save the content (using ObjectOutputStream) and load it again when the user wishes to do so.

When I started this I wasn't familiar with the classes involved and I think that I have figured out most of it. I had a lot of issues with memory management and the application now runs at 100 mb memory. (Got it down to 100 from 200 mb). There is probably some bad code there that causes this, which I will take a look at later, but at least the application doesn't crash because of OutOfMemoryException anymore! I'll probably post some pictures when I have added all the necessary buttons, the model part is done, I just have to implement the view.
5  Java Game APIs & Engines / Java 2D / Re: Need help with yet another tile based map editor! on: 2011-07-04 17:57:22
Yeah, it's now possible to paint on my canvas, my only problem is that all that has been drawn resets everytime i either scroll or resize the window.Does it happen becuase of a method I've forgotten to override or something?
6  Java Game APIs & Engines / Java 2D / [Solved] Need help with yet another tile based map editor! on: 2011-07-04 12:26:12
I've been implementing a tile based map editor for some days now and I'm having some problems with the painting grid.

How do i do it? I started by creating a JPanel with gridlayout, and fill it with objects, but this doesn't seem like a good way to go. I'm thinking of  implementing one big canvas(?), check for mouseClick and calculate the position to draw the sprite on. Does it sound good?

I'm new to graphical programming in Java and I have no idea of what classes to use, so all help you can provide is appreciated!
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.

CogWheelz (14 views)
2014-08-01 22:53:16

CogWheelz (14 views)
2014-08-01 22:51:43

CopyableCougar4 (15 views)
2014-08-01 19:37:19

CogWheelz (19 views)
2014-07-30 21:08:39

Riven (27 views)
2014-07-29 18:09:19

Riven (16 views)
2014-07-29 18:08:52

Dwinin (14 views)
2014-07-29 10:59:34

E.R. Fleming (35 views)
2014-07-29 03:07:13

E.R. Fleming (13 views)
2014-07-29 03:06:25

pw (44 views)
2014-07-24 01:59:36
Resources for WIP games
by CogWheelz
2014-08-01 18:20:17

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

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

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

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

HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22
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!