Class: WallFactory
- Inherits:
-
Object
- Object
- WallFactory
- Defined in:
- lib/games_paradise/flappy_bird/gosu/wallfactory.rb
Overview
#
Instance Attribute Summary collapse
-
#x ⇒ Object
Returns the value of attribute x.
-
#y ⇒ Object
Returns the value of attribute y.
Instance Method Summary collapse
-
#add ⇒ Object
# === add.
-
#draw ⇒ Object
# === draw ========================================================================= #.
-
#initialize(window) ⇒ WallFactory
constructor
# === initialize ========================================================================= #.
-
#reset ⇒ Object
# === reset (reset tag) ========================================================================= #.
-
#update ⇒ Object
# === update.
Constructor Details
#initialize(window) ⇒ WallFactory
#
initialize
#
13 14 15 16 |
# File 'lib/games_paradise/flappy_bird/gosu/wallfactory.rb', line 13 def initialize(window) @window = window reset end |
Instance Attribute Details
#x ⇒ Object
Returns the value of attribute x.
7 8 9 |
# File 'lib/games_paradise/flappy_bird/gosu/wallfactory.rb', line 7 def x @x end |
#y ⇒ Object
Returns the value of attribute y.
8 9 10 |
# File 'lib/games_paradise/flappy_bird/gosu/wallfactory.rb', line 8 def y @y end |
Instance Method Details
#add ⇒ Object
#
add
Add a 2 walls separate by a standard height
#
41 42 43 44 45 46 47 |
# File 'lib/games_paradise/flappy_bird/gosu/wallfactory.rb', line 41 def add wall_down = Wall.new(@window, 'down') wall_up = Wall.new(@window, 'up') wall_up.y = wall_down.y - wall_up.height - @offset_y @window.entities.push(wall_down, wall_up) @window.walls.push(wall_down, wall_up) end |
#draw ⇒ Object
#
draw
#
52 53 |
# File 'lib/games_paradise/flappy_bird/gosu/wallfactory.rb', line 52 def draw end |
#reset ⇒ Object
#
reset (reset tag)
#
21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/games_paradise/flappy_bird/gosu/wallfactory.rb', line 21 def reset # ======================================================================= # # === @counter # ======================================================================= # @counter = 0 # ======================================================================= # # === @offset_y # ======================================================================= # @offset_y = 100 # ======================================================================= # # === @intervall # ======================================================================= # @intervall = 175 end |
#update ⇒ Object
#
update
Add a wall for each intervall
#
60 61 62 63 64 65 66 67 |
# File 'lib/games_paradise/flappy_bird/gosu/wallfactory.rb', line 60 def update if @counter >= @intervall add @counter = 0 else @counter += 1 end end |