Class: Player

Inherits:
Object
  • Object
show all
Defined in:
lib/player.rb

Instance Method Summary collapse

Constructor Details

#initialize(api) ⇒ Player

Returns a new instance of Player.



2
3
4
# File 'lib/player.rb', line 2

def initialize(api)
  @api = api
end

Instance Method Details

#go(x, y, z) ⇒ Object



6
7
8
# File 'lib/player.rb', line 6

def go(x,y,z)
  @api.send("player.setTile(#{x},#{y},#{z})")
end

#locationObject



10
11
12
13
# File 'lib/player.rb', line 10

def location
  response = @api.send_and_receive("player.getTile()")
  response.split(',').map { |s| s.to_i }
end