Dreamscape

Thanks for the collision tips. Over the past few days I’ve been thinking about easy ways to create a map and load it, after a bit of thought I decided that creating a text document with numbers to reference specific tiles would be best; After that I took some time tonight and figured out how to read from a text document and sort the tiles quickly.
Now to write and test the actual tile loading!

Edit: It just occurred to me that loading a map this way, due to it’s simplicity, would actually allow me to create a simple map editor very easily. I <3 Getting ideas from random places!

I’m back from my little two week long Java break. I’m more-or-less just throwing around random ideas of how to do things and that now. So-far tonight I’ve started writing a class to create and save JPanels and JButtons so they don’t need to be re-created every time you move from menu to menu.

Why are you recreating them in the first place? Your JButtons/JPanels should be class fields, and you can just add/remove them at will.

Someone told me that I should create every menu on a different JPanel because it’s a better way to do it, that’s why. It seems like everyone else thinks that it’s a bit of a ridiculous idea so I’ll drop it.

fyi I never ever used Panel/JPanels
not saying you shouldn’t, but I never saw the point =>

Its not much of a hassle for Java to create a JPanel a few times. You shouldn’t spend time trying to optimize before you see a need to. If it’s not lagging or slowing you down, don’t try to optimize it.

I use the approach you’re talking about, where I have each view/menu on separate JPanels. It works like a charm, and it is very easy to control. But you’re removing buttons and such when certain buttons are clicked, like in the actionlistener on the continue-button.

Instead, you could try a very different approach. The menus could be on several JPanels, which you can switch between by simply changing the contentpane on your gameframe. Roll in the menu on its own panel, menuPanel, and then when a button is pressed and all the needed information to start the game is in order, you change the contentPane of your frame from menuPanel to a new gamePanel, which handles rendering of the game.

If you want, you can add even more panels on top of your gamePanel…the frame won’t mind. So if you want in-game menus, you’re free to use Swing for those, without having to kill the gamePanel. You can even spawn extra JPanels IN your gamePanel!

About your buttons, I think they look fine. Actually, they’re spectacular for a Paint-job. They might benefit from a little blur on the edges, but what would REALLY help them, is if they weren’t on a monotonous grey background. The surrounding colors make a huge difference to an image (which is why AmbiLight is popular for TVs).

I did some quick n’ dirty image editing to put your button on a vibrant game, so you can see what I mean. When surrounded by colors and graphics that aren’t as unnatural as a completely monotonous grey, the pixelated edges even seem to give the button a more realistic look, than if it were blurred. Maybe a mix of the two approaches would be more spot on?

http://img18.imageshack.us/img18/4040/newgamebutton.png

I didn’t mean not to use different JPanels, I meant there’s no need to “save” GUI components, if that’s the case you need to fix your scope/access problems.
@Ultroman: Tyrian ;D

I agree.

And yes…TYRIAN! With hotdog guns!

Hmm… I’ll do a bit of messing around with JPanels and the button does look pretty good with more color, thanks!

Now for a small update; I’ve finally found out how to separate all my classes and have them in multiple files instead of having a 1000+ line file with multiple classes and stuff mashed together within. At the moment I’m separating the whole program into multiple files, I might end up doing a re-write but I’m not sure yet.

And carrots… now that doesnt fit =D

Yeah, I got the Super Carrot right after taking that screen, but I couldn’t be bothered to take another one. Still got the savegame, though :slight_smile:

Finally figured out how to do collision detection, now to figure out how to apply it to a whole screen of tiles instead of just two squares.

Just check the immediate area around each entity against collisions. Don’t check each tile on the map.

It’s been awhile but here are a few updates:

Updates:

  • Created and implemented a map loader.
  • Sprites are now working with animations.
  • A Derby database has been created and set up for items, creatures, loot tables, etc…
  • Everything has been re-written and separated into packages and multiple class files instead of one huge and un-editable file.

You seem to be doing fine :smiley:

Going well, then :slight_smile:

Any chance we can see some running application?

Maybe when I get a bit more done. There’s not much to do other than move a sprite around the screen and click through menus atm.

Update:

  • Collision detection is now working but extremely buggy.
  • The code is being re-organized and partially re-written again as to separate the logic and rendering.
  • A few map tiles have been created by an acquaintance of mine. A few of them have been implemented and are working in the game.
  • The Derby database has been scrapped and I’m having to switch back to using text files to save data.

Because Ultroman wanted to see what’s working at the moment, here you go (http://www.mediafire.com/download.php?zay8dt17vfdssit). All that you can do at the moment is to walk around on the map and get stuck on the pathway tiles because of bugs with the collision code.

Update:

  • The code has been re-written and is both working faster and easier to understand now.
  • Collision detection has been fixed and is working perfectly.

Where can I download the new version? ;D