Class: Doom::Game::SectorEffects::FireFlicker
- Inherits:
-
Object
- Object
- Doom::Game::SectorEffects::FireFlicker
- Defined in:
- lib/doom/game/sector_effects.rb
Overview
T_FireFlicker (type 17): random fire-like flickering
Instance Method Summary collapse
-
#initialize(sector, minlight) ⇒ FireFlicker
constructor
A new instance of FireFlicker.
- #update ⇒ Object
Constructor Details
#initialize(sector, minlight) ⇒ FireFlicker
Returns a new instance of FireFlicker.
160 161 162 163 164 165 |
# File 'lib/doom/game/sector_effects.rb', line 160 def initialize(sector, minlight) @sector = sector @maxlight = sector.light_level @minlight = minlight + 16 # fire doesn't go as dark @count = 4 end |
Instance Method Details
#update ⇒ Object
167 168 169 170 171 172 173 174 175 |
# File 'lib/doom/game/sector_effects.rb', line 167 def update @count -= 1 return if @count > 0 amount = (rand(4)) * 16 # 0, 16, 32, or 48 level = @maxlight - amount @sector.light_level = level < @minlight ? @minlight : level @count = 4 end |