Method: Core::Game::MapObject#initialize
- Defined in:
- lib/game/map/map_object.rb
#initialize(x, y, props) ⇒ MapObject
Returns a new instance of MapObject.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/game/map/map_object.rb', line 11 def initialize(x, y, props) file = props[:file] if file @graphics = Core.tiles("chars/#{file}", -4, -4) else @graphics = nil file = "unnamed" end @properties = props @follow = false @index = 0 @x, @y = x, y @tx, @ty = x/32, y/32 # tile based position, used for collision @z = Core::MAPOBJECT_Z @z += props[:z] if props[:z] @speed = 0 @speed += props[:speed] if props[:speed] @dx = @dy = 0 # distance to move, should be multiple of @speed @dead = false @steps = 0 @trigger = nil @name = "mapobject-#{file.downcase}-#{rand(1000)}" @through = false @setup = true @stepped = false end |