Class: GamesAndRpgParadise::Characters

Inherits:
Chingu::GameObject
  • Object
show all
Defined in:
lib/games_and_rpg_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

Constructor Details

#initialize(options = {}) ⇒ Characters

Returns a new instance of Characters.



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/games_and_rpg_paradise/gui/gosu/chinguroids/characters.rb', line 50

def initialize(options={})
  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

#updateObject



67
68
69
70
71
72
73
74
# File 'lib/games_and_rpg_paradise/gui/gosu/chinguroids/characters.rb', line 67

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