Class: Characters
- Inherits:
-
Chingu::GameObject
- Object
- Chingu::GameObject
- Characters
- Defined in:
- lib/games_paradise/gui/gosu/chinguroids/characters.rb
Overview
CHARACTERS
called in ending.rb, in Ending3 gamestate
Direct Known Subclasses
Char1, Char10, Char11, Char12, Char13, Char14, Char15, Char2, Char3, Char4, Char5, Char6, Char7, Char8, Char9
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Characters
constructor
A new instance of Characters.
- #update ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Characters
Returns a new instance of Characters.
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/games_paradise/gui/gosu/chinguroids/characters.rb', line 48 def initialize(={}) super self.x = rand(812) - 6 # place characters randomly all over if rand(5) == 1 self.y = rand(100) + 310 elsif rand(4) == 1 self.y = rand(125) + 210 elsif rand(3) == 1 self.y = rand(80) + 210 elsif rand(2) == 1 self.y = rand(60) + 210 else self.y = rand(50) + 210 end end |
Instance Method Details
#update ⇒ Object
65 66 67 68 69 70 71 72 |
# File 'lib/games_paradise/gui/gosu/chinguroids/characters.rb', line 65 def update self.factor = (@y-150)/400.0 # character size is affected by y position self.zorder = @y # character zorder is affected by y position if rand(50) == 1; @x += @motion; end # random crowd movements if rand(50) == 1; @x -= @motion; end if rand(150) == 1; @y += @motion; end if rand(150) == 1; @y -= @motion; end end |