marrus-sh / jelli

A game engine! Currently being developed.
MIT License
1 stars 0 forks source link

Fit a 16x16 peg into a 16x16 hole #14

Open marrus-sh opened 8 years ago

marrus-sh commented 8 years ago

This should be possible, smdh!

marrus-sh commented 8 years ago

This is actually already fixed if everything is lined up PERFECTLY… but take the following case:

   
     
  🐊

If 🐊 uses TargetBy(1, -1), 🐊 will not go into the gap, because at each calculation the x and y will be a float (and thus a little above, or a little below). Ideally the code would check to see if such gaps are being passed over, and (if possible) try to fit 🐊 in them instead.

marrus-sh commented 8 years ago

(Note: Ideally this should not necessarily be a simple matter of rounding, so that the same holds true if you have two characters at float positions with a similar gap between them, and a third trying to fit between)

marrus-sh commented 8 years ago

Rounding to the nearest pixel may be an appropriate solution to this problem, as it will ensure that any time a sprite looks like it can fit in a hole, it will.

marrus-sh commented 8 years ago

However ^ will not alone solve the problem if the velocity vector is, say, ⟨1, -2⟩ (not possible right now but this may change in the future)

marrus-sh commented 8 years ago

Nearest-pixel rounding has now been implemented, at least