-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@co012/position and bounds #33
Conversation
…er extends GameObject
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, a lot of good changes as far as I can tell. I do have a few comments though!
private Point2D getBoundPosition(Point2D pos) { | ||
double x = Math.max(0, Math.min(bounds.getX(), pos.getX())); | ||
double y = Math.max(0, Math.min(bounds.getY(), pos.getY())); | ||
return new Point2D(x, y); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The behavior of bounds is inconsistent - top and left bounds stop the player immediately, while the right and bottom ones let them cross up to half of the player's size.
I think there are two equally good options from here:
- change from 0 to -0.5 in Math.max
or: - change bounds from (9.5, 9.5) to (9, 9), or in general when read from config: (width-1, height-1)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You, are right. I'll go with your first suggestion
import java.lang.reflect.Field; | ||
import java.util.LinkedHashSet; | ||
import java.util.Optional; | ||
import java.util.Set; | ||
import javafx.beans.property.ObjectProperty; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unused import
Co-authored-by: Marcin Hawryluk <70582973+mhawryluk@users.noreply.github.com>
Description
Checklist