Class: Hoop
- Inherits:
-
Object
- Object
- Hoop
- Defined in:
- lib/rubyhop/hoop.rb
Instance Attribute Summary collapse
-
#active ⇒ Object
Returns the value of attribute active.
-
#x ⇒ Object
Returns the value of attribute x.
-
#y ⇒ Object
Returns the value of attribute y.
Instance Method Summary collapse
- #draw ⇒ Object
-
#initialize ⇒ Hoop
constructor
A new instance of Hoop.
- #miss(player) ⇒ Object
- #update(movement) ⇒ Object
Constructor Details
Instance Attribute Details
#active ⇒ Object
Returns the value of attribute active.
2 3 4 |
# File 'lib/rubyhop/hoop.rb', line 2 def active @active end |
#x ⇒ Object
Returns the value of attribute x.
2 3 4 |
# File 'lib/rubyhop/hoop.rb', line 2 def x @x end |
#y ⇒ Object
Returns the value of attribute y.
2 3 4 |
# File 'lib/rubyhop/hoop.rb', line 2 def y @y end |
Instance Method Details
#draw ⇒ Object
20 21 22 |
# File 'lib/rubyhop/hoop.rb', line 20 def draw @hoop.draw @x - 66, @y - 98, 1000 - @x end |
#miss(player) ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/rubyhop/hoop.rb', line 9 def miss player if (@x - player.x).abs < 12 && (@y - player.y).abs > 72 # the player missed the hoop return true end false end |
#update(movement) ⇒ Object
17 18 19 |
# File 'lib/rubyhop/hoop.rb', line 17 def update movement @x -= movement end |