Class: Knight
- Inherits:
-
Chingu::GameObject
- Object
- Chingu::GameObject
- Knight
- Defined in:
- lib/games_paradise/gui/gosu/chinguroids/characters.rb
Overview
KNIGHT
called in beginning.rb, in Introduction gamestate
Instance Method Summary collapse
-
#enter_ship ⇒ Object
called in Introduction gamestate.
-
#initialize(options) ⇒ Knight
constructor
A new instance of Knight.
-
#movement ⇒ Object
called in Introduction gamestate.
-
#speak ⇒ Object
called in Introduction gamestate.
- #update ⇒ Object
Constructor Details
#initialize(options) ⇒ Knight
Returns a new instance of Knight.
5 6 7 8 9 10 11 12 |
# File 'lib/games_paradise/gui/gosu/chinguroids/characters.rb', line 5 def initialize() super @image = Image["media/assets/knight.png"] @voice = Sound["media/audio/mumble.ogg"] @velox = 0 # x velocity starts as 0 @veloy = 0 # y velocity starts as 0 @factoring = 1 # used for shrinking Knight when he enters the ship end |
Instance Method Details
#enter_ship ⇒ Object
called in Introduction gamestate
16 17 18 19 |
# File 'lib/games_paradise/gui/gosu/chinguroids/characters.rb', line 16 def enter_ship # called in Introduction gamestate @veloy = 2 @factoring = 0.98 end |
#movement ⇒ Object
called in Introduction gamestate
13 14 15 |
# File 'lib/games_paradise/gui/gosu/chinguroids/characters.rb', line 13 def movement # called in Introduction gamestate @velox = -7 # move left end |
#speak ⇒ Object
called in Introduction gamestate
20 21 22 |
# File 'lib/games_paradise/gui/gosu/chinguroids/characters.rb', line 20 def speak # called in Introduction gamestate @voice.play end |
#update ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/games_paradise/gui/gosu/chinguroids/characters.rb', line 23 def update self.factor *= @factoring @x += @velox @y += @veloy if @x <= 400; @velox = 0; end if @y >= 450; @veloy = 0; end end |