Class: Logic::BaseLogic

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/games_paradise/flappy_bird/ruby2d/logic/base_logic.rb

Overview

Base logic class for the game’s logic elements.

Direct Known Subclasses

Bird, Ground, Pipe

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**attrs) ⇒ BaseLogic

Parameters:

  • Optional (Hash)

    logic attributes



28
29
30
31
32
33
34
# File 'lib/games_paradise/flappy_bird/ruby2d/logic/base_logic.rb', line 28

def initialize(**attrs)
  @game = attrs[:game]
  @width = attrs[:width]
  @height = attrs[:height]
  @x = attrs[:x]
  @y = attrs[:y]
end

Instance Attribute Details

#:gameLogic::Game (readonly)

Game’s main logic/rules

Returns:



17
18
19
# File 'lib/games_paradise/flappy_bird/ruby2d/logic/base_logic.rb', line 17

def :game
  @:game
end

#gameObject (readonly)

Returns the value of attribute game.



20
21
22
# File 'lib/games_paradise/flappy_bird/ruby2d/logic/base_logic.rb', line 20

def game
  @game
end

#heightObject

Returns the value of attribute height.



21
22
23
# File 'lib/games_paradise/flappy_bird/ruby2d/logic/base_logic.rb', line 21

def height
  @height
end

#widthObject

Returns the value of attribute width.



21
22
23
# File 'lib/games_paradise/flappy_bird/ruby2d/logic/base_logic.rb', line 21

def width
  @width
end

#xObject

Returns the value of attribute x.



21
22
23
# File 'lib/games_paradise/flappy_bird/ruby2d/logic/base_logic.rb', line 21

def x
  @x
end

#yObject

Returns the value of attribute y.



21
22
23
# File 'lib/games_paradise/flappy_bird/ruby2d/logic/base_logic.rb', line 21

def y
  @y
end