First, there are two types of collision detection: a posteriori and a priori. From what I can tell, you want to go with the second one. This means that you detect which objects will collide if you would move them and prevent the collision by adjusting the velocities. The other approach was mentioned by Portponky, but you really only want to do this for speed or for non-critical collision detection (particle systems, for example).
Now, rectangle vs. rectangle is not a really difficult test, IF your rectangles are not rotated (often called AABB, axis aligned bounding boxes). Let's say your rectangles are given by (l1,r1,t1,b1) and (l2,r2,t2,b2). Then the rectangles intersect if and only if (l1,r1) vs. (l2,r2) AND (t1,b1) vs. (t2,b2) intersect. Of course this only gives you the a posteriori test, for the a priori
you have to actually look at the movement of both (I hate to say it, but the best source is probably the N tutorial...).
Most importantly: search for a posteriori AABB collision detection, that
should yield much more results. Oh, and the difficulat part is usually the collision handling.
Your screen looks bad (and the OPs too) because your
present every piece of text as equally important, which clearly
is not the case. You can vary font size (more), font weighting (get a font family with at least three different weights) and color. Keep a consistent
feel throughout the whole UI, for example:
Money, HP, Energy etc. are all displayed in a thin weight with a distinct color
Button text is bold (btw, you should fix the spacing issues in your menu)
Headlines are bold (I would not put them in a single box like in your second screenshot, that just clutters the UI)
Also consider whitespace. I'd propose reading some articles about white space and usage of fonts in web design, the same principles apply for presenting information in-game.
True and not my point: I was referring to avoiding the overhead of message passing (components updating its dirty rectangles and what not). In my experience a custom buffer gives a good performance boost. Aside from that, decoupling the drawing logic from swing components as far as possible helps switching to other display libraries later on.
What a shame. I love it.
First, there are two types of collision detection: a posteriori and a priori. From what I can tell, you want to go with the second one. This means that you detect which objects will collide if you would move them and prevent the collision by adjusting the velocities. The other approach was mentioned by Portponky, but you really only want to do this for speed or for non-critical collision detection (particle systems, for example).
Now, rectangle vs. rectangle is not a really difficult test, IF your rectangles are not rotated (often called AABB, axis aligned bounding boxes). Let's say your rectangles are given by (l1,r1,t1,b1) and (l2,r2,t2,b2). Then the rectangles intersect if and only if (l1,r1) vs. (l2,r2) AND (t1,b1) vs. (t2,b2) intersect. Of course this only gives you the a posteriori test, for the a priori you have to actually look at the movement of both (I hate to say it, but the best source is probably the N tutorial...).
Most importantly: search for a posteriori AABB collision detection, that should yield much more results. Oh, and the difficulat part is usually the collision handling.
Your screen looks bad (and the OPs too) because your present every piece of text as equally important, which clearly is not the case. You can vary font size (more), font weighting (get a font family with at least three different weights) and color. Keep a consistent feel throughout the whole UI, for example:
Also consider whitespace. I'd propose reading some articles about white space and usage of fonts in web design, the same principles apply for presenting information in-game.
Make a cooldown class (with methods isDone() and reset() for example). It's one of the things you need constantly.
True and not my point: I was referring to avoiding the overhead of message passing (components updating its dirty rectangles and what not). In my experience a custom buffer gives a good performance boost. Aside from that, decoupling the drawing logic from swing components as far as possible helps switching to other display libraries later on.