more checking rooms

This commit is contained in:
anton.gurov
2019-11-12 14:52:17 +03:00
parent 4bdb51d9e3
commit 7837051e80
13 changed files with 82 additions and 37 deletions

View File

@ -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) &&