Class: Core::Game::Bubble

Inherits:
Core::GUI::Textfield show all
Defined in:
lib/game/npc/bubble.rb

Instance Attribute Summary

Attributes inherited from Core::GUI::Textfield

#max_width

Attributes inherited from Core::GUI::Element

#h, #w, #x, #xoff, #y, #yoff, #zoff

Instance Method Summary collapse

Methods inherited from Core::GUI::Textfield

#text=

Methods inherited from Core::GUI::Element

#remove?

Constructor Details

#initialize(text) ⇒ Bubble

Returns a new instance of Bubble.



6
7
8
9
# File 'lib/game/npc/bubble.rb', line 6

def initialize(text)
  super(0, 0, 0, 0, text, 20, :left, false, 256)
  @age = text.gsub("\n", "").size * Core.config[:text_speed]
end

Instance Method Details

#draw(x, y) ⇒ Object



19
20
21
22
23
24
# File 'lib/game/npc/bubble.rb', line 19

def draw(x, y)
  @x, @y = x-(@w/2)+16, y-40-@h
  super()
  c = Gosu::Color::GREEN
  Core.window.draw_triangle(@x+(@w/2)-4, @y+@h, c, @x+(@w/2)+4, @y+@h, c, @x+(@w/2), @y+@h+24, c, Core::MAPOBJECT_Z+100)
end

#updateObject



11
12
13
14
15
16
17
# File 'lib/game/npc/bubble.rb', line 11

def update
  if @age <= 0
    @remove = true
  else
    @age -= 1
  end
end