more checking rooms
This commit is contained in:
@ -8,14 +8,14 @@ type RectFill struct {
|
||||
Top, Bottom, Left, Right, TopLeft, TopRight, BottomLeft, BottomRight, Body interface{}
|
||||
}
|
||||
|
||||
func NewRect(x, y, w, h int) *Rect {
|
||||
return &Rect{x, y, w, h}
|
||||
func NewRect(x, y, w, h int) Rect {
|
||||
return Rect{x, y, w, h}
|
||||
}
|
||||
|
||||
func NewCenteredRect(source *Rect, w, h int) *Rect {
|
||||
func NewCenteredRect(source Rect, w, h int) Rect {
|
||||
targetX := source.X + source.W / 2 - w / 2
|
||||
targetY := source.Y + source.H / 2 - h / 2
|
||||
return &Rect{targetX, targetY, w, h}
|
||||
return Rect{targetX, targetY, w, h}
|
||||
}
|
||||
|
||||
func (r *Rect) Blit(fillage RectFill, layer Putable) {
|
||||
@ -52,7 +52,7 @@ func (r *Rect) Blit(fillage RectFill, layer Putable) {
|
||||
layer.Put(r.X+r.W - 1, r.Y+r.H - 1, fillage.BottomRight)
|
||||
}
|
||||
|
||||
func (self *Rect) Intersects(other *Rect) bool {
|
||||
func (self *Rect) Intersects(other Rect) bool {
|
||||
if self.X <= (other.X+other.W) &&
|
||||
(self.X+self.W) >= other.X &&
|
||||
self.Y <= (other.Y+other.Y) &&
|
||||
|
Reference in New Issue
Block a user