Class: GamesAndRpgParadise::Cursor
- Inherits:
-
Object
- Object
- GamesAndRpgParadise::Cursor
show all
- Defined in:
- lib/games_and_rpg_paradise/gui/gosu/aero_exploder/cursor.rb
Overview
GamesAndRpgParadise::Cursor
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(parent_widget) ⇒ Cursor
17
18
19
20
|
# File 'lib/games_and_rpg_paradise/gui/gosu/aero_exploder/cursor.rb', line 17
def initialize(parent_widget)
@parent_widget = parent_widget
reset
end
|
Instance Attribute Details
#cur_x ⇒ Object
Returns the value of attribute cur_x.
11
12
13
|
# File 'lib/games_and_rpg_paradise/gui/gosu/aero_exploder/cursor.rb', line 11
def cur_x
@cur_x
end
|
#cur_y ⇒ Object
Returns the value of attribute cur_y.
12
13
14
|
# File 'lib/games_and_rpg_paradise/gui/gosu/aero_exploder/cursor.rb', line 12
def cur_y
@cur_y
end
|
Instance Method Details
48
49
50
51
52
53
54
55
|
# File 'lib/games_and_rpg_paradise/gui/gosu/aero_exploder/cursor.rb', line 48
def button_down(id)
case id
when ::Gosu::MsLeft @parent_widget.deduct_one_bullet @cur_smp.play if @parent_widget.any_bullets_left?
@sound_when_there_are_no_bullets_Left.play if @parent_widget.n_bullets? <= 0
end
end
|
#draw ⇒ Object
60
61
62
|
# File 'lib/games_and_rpg_paradise/gui/gosu/aero_exploder/cursor.rb', line 60
def draw
@cur_img.draw(@cur_x, @cur_y, 10)
end
|
#reset ⇒ Object
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/games_and_rpg_paradise/gui/gosu/aero_exploder/cursor.rb', line 25
def reset
@cur_x = 0
@cur_y = 0
@cur_img = ::Gosu::Image.new('data/cursor_img.png')
@cur_smp = ::Gosu::Sample.new('data/cursor.wav')
@sound_when_there_are_no_bullets_Left = ::Gosu::Sample.new('data/empty.ogg')
end
|
#update(mouse_x, mouse_y) ⇒ Object
40
41
42
43
|
# File 'lib/games_and_rpg_paradise/gui/gosu/aero_exploder/cursor.rb', line 40
def update(mouse_x, mouse_y)
@cur_x = mouse_x - @cur_img.width / 2
@cur_y = mouse_y - @cur_img.height / 2
end
|