Class: GamesAndRpgParadise::Knight
- Inherits:
-
Chingu::GameObject
- Object
- Chingu::GameObject
- GamesAndRpgParadise::Knight
- Defined in:
- lib/games_and_rpg_paradise/gui/gosu/chinguroids/characters.rb
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.
7 8 9 10 11 12 13 14 |
# File 'lib/games_and_rpg_paradise/gui/gosu/chinguroids/characters.rb', line 7 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
18 19 20 21 |
# File 'lib/games_and_rpg_paradise/gui/gosu/chinguroids/characters.rb', line 18 def enter_ship # called in Introduction gamestate @veloy = 2 @factoring = 0.98 end |
#movement ⇒ Object
called in Introduction gamestate
15 16 17 |
# File 'lib/games_and_rpg_paradise/gui/gosu/chinguroids/characters.rb', line 15 def movement # called in Introduction gamestate @velox = -7 # move left end |
#speak ⇒ Object
called in Introduction gamestate
22 23 24 |
# File 'lib/games_and_rpg_paradise/gui/gosu/chinguroids/characters.rb', line 22 def speak # called in Introduction gamestate @voice.play end |
#update ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/games_and_rpg_paradise/gui/gosu/chinguroids/characters.rb', line 25 def update self.factor *= @factoring @x += @velox @y += @veloy if @x <= 400; @velox = 0; end if @y >= 450; @veloy = 0; end end |