Class: Yuki::Building_Object
- Defined in:
- scripts/01450 Systems/00003 Map Engine/00001 Graphics/00400 Particles/00505 Building_Object.rb
Overview
Object that describe a building on the Map as a Particle
Instance Attribute Summary collapse
-
#disposed ⇒ Boolean
(also: #disposed?)
readonly
If the building is disposed.
-
#sprite ⇒ Sprite
The building sprite.
Instance Method Summary collapse
-
#dispose
Dispose the building.
-
#initialize(image, x, y, oy) ⇒ Building_Object
constructor
Create a new Building_Object.
-
#update
Update the building position (x, y, z).
Constructor Details
#initialize(image, x, y, oy) ⇒ Building_Object
Create a new Building_Object
16 17 18 19 20 21 22 23 24 25 |
# File 'scripts/01450 Systems/00003 Map Engine/00001 Graphics/00400 Particles/00505 Building_Object.rb', line 16 def initialize(image, x, y, oy) @sprite = ::Sprite.new(Particles., true) @sprite.bitmap = ::RPG::Cache.autotile(image) @sprite.oy = @sprite.bitmap.height - oy - 16 @x = (x + MapLinker.get_OffsetX) * 16 @y = (y + MapLinker.get_OffsetY) * 16 @real_y = (y + MapLinker.get_OffsetY) * 128 @map_id = $game_map.map_id update end |
Instance Attribute Details
#disposed ⇒ Boolean (readonly) Also known as: disposed?
If the building is disposed
7 8 9 |
# File 'scripts/01450 Systems/00003 Map Engine/00001 Graphics/00400 Particles/00505 Building_Object.rb', line 7 def disposed @disposed end |
#sprite ⇒ Sprite
The building sprite
10 11 12 |
# File 'scripts/01450 Systems/00003 Map Engine/00001 Graphics/00400 Particles/00505 Building_Object.rb', line 10 def sprite @sprite end |
Instance Method Details
#dispose
Dispose the building
40 41 42 43 44 45 46 47 |
# File 'scripts/01450 Systems/00003 Map Engine/00001 Graphics/00400 Particles/00505 Building_Object.rb', line 40 def dispose return if disposed? @sprite.dispose unless @sprite.disposed? @sprite = nil @disposed = true Yuki::Particles.clean_stack end |
#update
Update the building position (x, y, z)
28 29 30 31 32 33 34 35 36 37 |
# File 'scripts/01450 Systems/00003 Map Engine/00001 Graphics/00400 Particles/00505 Building_Object.rb', line 28 def update return if disposed? return dispose if @map_id != $game_map.map_id dx = $game_map.display_x / 8 dy = $game_map.display_y / 8 @sprite.x = (@x - dx) @sprite.y = (@y - dy) @sprite.z = (@real_y - $game_map.display_y + 4) / 4 + 94 end |