Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (754)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (842)
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 17: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?

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 16: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 10: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 19: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 15: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 10: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]
DesertCoockie (20 views)
2018-05-13 18:23:11

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

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

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

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

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

Solater (95 views)
2018-03-17 05:04:08

nelsongames (168 views)
2018-03-05 17:56:34

Gornova (378 views)
2018-03-02 22:15:33

buddyBro (1038 views)
2018-02-28 16:59:18
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!