Skip to content

u/DrSweetscent

In this archive from Nov 2010 to May 2012

0
posts
17
comments
0
media
48
score

Top comments

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.

3 points

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.

3 points

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.

2 points

Subreddits

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.