We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8c6d007 commit 85f946aCopy full SHA for 85f946a
src/main/scala-2.11/nl/amsscala/simplegame/game.scala
@@ -132,9 +132,12 @@ private class Monster[T: Numeric](val pos: Position[T]) {
132
}
133
134
override def toString = s"${this.getClass.getSimpleName} $pos"
135
-
136
- //protected[simplegame] def isValidPosition(canvas: dom.html.Canvas) ={}
137
- // pos.isWithinTheCanvas(canvas, Hero.size.asInstanceOf[T])
+ protected[simplegame] def isValidPosition(canvas: dom.html.Canvas) = {
+ pos.isValidPosition(
+ Position(canvas.width, canvas.height).asInstanceOf[Position[T]],
138
+ pos + Hero.size.asInstanceOf[T]
139
+ )
140
+ }
141
142
143
/**
0 commit comments