Class: RoadToRubykaigi::Sprite::Effect

Inherits:
RoadToRubykaigi::Sprite show all
Defined in:
lib/road_to_rubykaigi/sprite/effect.rb

Direct Known Subclasses

HeartEffect, LightningEffect, NoteEffect

Instance Method Summary collapse

Instance Method Details

#bounding_boxObject



57
58
59
# File 'lib/road_to_rubykaigi/sprite/effect.rb', line 57

def bounding_box
  { x: @x, y: @y, width: 1, height: 1 }
end

#characterObject



49
50
51
# File 'lib/road_to_rubykaigi/sprite/effect.rb', line 49

def character
  self.class::SYMBOL
end

#expired?Boolean

Returns:



53
54
55
# File 'lib/road_to_rubykaigi/sprite/effect.rb', line 53

def expired?
  (Time.now - @start_time) >= self.class::DURATION
end

#updateObject



44
45
46
47
# File 'lib/road_to_rubykaigi/sprite/effect.rb', line 44

def update
  elapsed = Time.now - @start_time
  @y = (@y - elapsed).to_i
end