Move point tests
This commit is contained in:
@ -1,19 +1,4 @@
|
||||
module Game
|
||||
struct Point
|
||||
property x : Int32
|
||||
property y : Int32
|
||||
|
||||
def initialize(@x : Int32, @y : Int32)
|
||||
end
|
||||
|
||||
getter x
|
||||
getter y
|
||||
|
||||
def distance(other) : Int32
|
||||
return (other.x - @x).abs + (other.y - @y).abs
|
||||
end
|
||||
end
|
||||
|
||||
class Map
|
||||
alias TileRow = Array(Tile)
|
||||
alias DataArray = Array(TileRow)
|
||||
|
14
src/game/point.cr
Normal file
14
src/game/point.cr
Normal file
@ -0,0 +1,14 @@
|
||||
struct Game::Point
|
||||
property x : Int32
|
||||
property y : Int32
|
||||
|
||||
def initialize(@x : Int32, @y : Int32)
|
||||
end
|
||||
|
||||
getter x
|
||||
getter y
|
||||
|
||||
def distance(other) : Int32
|
||||
return (other.x - @x).abs + (other.y - @y).abs
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user